![]() |
Gorgon Game Engine
|
This namespace contains window manager specific functionality. More...
Namespaces | |
internal | |
Classes | |
class | Icon |
Represents an icon object that can be used as window icon. More... | |
class | Monitor |
class | Pointer |
Represents a hardware/OS pointer graphic. More... | |
Functions | |
void | addpadding (const Monitor *monitor, int l, int t, int r, int b) |
void | assertkeys (Window &wind, Gorgon::internal::windowdata *data) |
Input::Mouse::Button | buttonfromx11 (unsigned btn) |
intptr_t | CurrentContext () |
Returns an identifier for the current context. More... | |
::Window | getanywindow () |
std::string | GetAtomName (Atom atom) |
Containers::Image | GetClipboardBitmap () |
Returns a bitmap from the clipboard. More... | |
std::vector< Resource::GID::Type > | GetClipboardFormats () |
Returns the list of formats that is in the clipboard supported by the Gorgon Library. More... | |
std::vector< std::string > | GetClipboardList (Resource::GID::Type type=Resource::GID::FileList) |
Returns a list of strings from the clipboard. More... | |
std::string | GetClipboardText (Resource::GID::Type type=Resource::GID::Text) |
Returns the clipboard text. More... | |
Geometry::Point | GetMousePosition (Gorgon::internal::windowdata *wind) |
void | handlebuttonpressevent (XEvent event, Window &wind) |
void | handlebuttonreleaseevent (XEvent event, Window &wind) |
void | handlednddrop (XEvent event, Window &wind) |
void | handledndenter (XEvent event, Window &wind) |
void | handledndevent (XEvent event, Window &wind) |
void | handledndleave (XEvent, Window &wind) |
void | handledndposition (XEvent event, Window &wind) |
void | handledndselectionnotify (XEvent event, Window &wind) |
void | handleinputevent (XEvent event, Window &wind) |
void | handlekeypressevent (XEvent event, Window &wind) |
void | handlekeyreleaseevent (XEvent event, Window &wind) |
void | init () |
void | Initialize () |
Initializes window manager system. More... | |
Input::Keyboard::Key | mapx11key (KeySym key, unsigned int keycode) |
std::string | osgetkeyname (Input::Keyboard::Key key) |
void | SetClipboardBitmap (Containers::Image img, bool append=false) |
Changes the clipboard to the given image. More... | |
void | SetClipboardList (std::vector< std::string > list, Resource::GID::Type type=Resource::GID::FileList, bool append=false) |
Sets a list of strings to the clipboard. More... | |
void | SetClipboardText (const std::string &text, Resource::GID::Type type=Resource::GID::Text, bool unicode=true, bool append=false) |
Sets the clipboard text to given string. More... | |
std::string | xeventname (XEvent &event) |
This namespace contains window manager specific functionality.
This including creating windows, obtaining input, creating graphics context.
void Gorgon::WindowManager::addpadding | ( | const Monitor * | monitor, |
int | l, | ||
int | t, | ||
int | r, | ||
int | b | ||
) |
void Gorgon::WindowManager::assertkeys | ( | Window & | wind, |
Gorgon::internal::windowdata * | data | ||
) |
Input::Mouse::Button Gorgon::WindowManager::buttonfromx11 | ( | unsigned | btn | ) |
References Gorgon::Input::Keyboard::Keycodes::Left, Gorgon::Input::Mouse::Middle, Gorgon::Input::Mouse::None, Gorgon::Input::Keyboard::Keycodes::Right, Gorgon::Input::Mouse::X1, Gorgon::Input::Mouse::X2, Gorgon::Input::Mouse::X3, Gorgon::Input::Mouse::X4, Gorgon::Input::Mouse::X5, and Gorgon::Input::Mouse::X6.
intptr_t CurrentContext | ( | ) |
Returns an identifier for the current context.
::Window Gorgon::WindowManager::getanywindow | ( | ) |
References Gorgon::WindowManager::internal::getdata(), and Window::Windows.
std::string Gorgon::WindowManager::GetAtomName | ( | Atom | atom | ) |
Containers::Image GetClipboardBitmap | ( | ) |
Returns a bitmap from the clipboard.
This function chooses the best fitting image from the clipboard. However, in Windows it is not always possible to get a transparent image from browsers. If necessary, it is possible to get HTML code, then fetch the image from the internet using Network module.
References basic_Image< T_ >::Duplicate(), getanywindow(), Gorgon::WindowManager::internal::getdata(), Window::Windows, XA_BMP, XA_CLIPBOARD, XA_CP_PROP, XA_JPG, and XA_PNG.
std::vector< Resource::GID::Type > GetClipboardFormats | ( | ) |
Returns the list of formats that is in the clipboard supported by the Gorgon Library.
Use GetAllClipboardFormats to get OS dependent clipboard format list. The following list is the currently supported formats:
References Gorgon::Resource::GID::FileList, Gorgon::Resource::GID::HTML, Gorgon::Resource::GID::Image_Data, Gorgon::Containers::PushBackUnique(), Gorgon::Resource::GID::Text, Gorgon::Resource::GID::URIList, Gorgon::Resource::GID::URL, XA_BMP, XA_Filelist, XA_JPG, XA_PNG, XA_STRING, XA_TEXT, XA_TEXT_HTML, XA_URL, and XA_UTF8_STRING.
std::vector< std::string > GetClipboardList | ( | Resource::GID::Type | type = Resource::GID::FileList | ) |
Returns a list of strings from the clipboard.
If FileList is supplied, it will specifically be files copied from clipboard. If your application can handle remote resources, it would be better to use URIList, as URIList can contain list of any resources, including internet sources like HTTP/FTP/SFTP.
References Gorgon::Resource::GID::FileList, getanywindow(), Gorgon::WindowManager::internal::getdata(), Gorgon::Resource::GID::URIList, Window::Windows, XA_CLIPBOARD, XA_CP_PROP, and XA_Filelist.
std::string GetClipboardText | ( | Resource::GID::Type | type = Resource::GID::Text | ) |
Returns the clipboard text.
If there is no data or its incompatible with text, empty string is returned. May require an existing window. This function will prioritize Unicode text if it exists. type refers to the clipboard type. Currently Text and HTML are supported. This function might hang the program if the owner of the clipboard does not respond. In the future, there might be an asynchronous version of this function.
References getanywindow(), Gorgon::WindowManager::internal::getdata(), Gorgon::Resource::GID::HTML, Gorgon::Resource::GID::Text, Gorgon::Resource::GID::URL, Window::Windows, XA_CLIPBOARD, XA_CP_PROP, XA_STRING, XA_TEXT, XA_TEXT_HTML, XA_URL, and XA_UTF8_STRING.
Geometry::Point Gorgon::WindowManager::GetMousePosition | ( | Gorgon::internal::windowdata * | wind | ) |
References windowdata::handle, basic_Point< T_ >::X, and basic_Point< T_ >::Y.
void Gorgon::WindowManager::handlebuttonpressevent | ( | XEvent | event, |
Window & | wind | ||
) |
void Gorgon::WindowManager::handlebuttonreleaseevent | ( | XEvent | event, |
Window & | wind | ||
) |
References buttonfromx11(), and Window::mouse_up().
void Gorgon::WindowManager::handlednddrop | ( | XEvent | event, |
Window & | wind | ||
) |
void Gorgon::WindowManager::handledndenter | ( | XEvent | event, |
Window & | wind | ||
) |
References Gorgon::WindowManager::internal::getdata().
void Gorgon::WindowManager::handledndevent | ( | XEvent | event, |
Window & | wind | ||
) |
void Gorgon::WindowManager::handledndleave | ( | XEvent | , |
Window & | wind | ||
) |
void Gorgon::WindowManager::handledndposition | ( | XEvent | event, |
Window & | wind | ||
) |
References Gorgon::Resource::GID::File, Gorgon::WindowManager::internal::getdata(), Gorgon::Input::GetDragOperation(), Gorgon::OS::GetEnvVar(), Gorgon::Input::IsDragging(), DragInfo::MarkAsOS(), Gorgon::Input::PrepareDrag(), Gorgon::Input::StartDrag(), Gorgon::Resource::GID::Text, XA_Filelist, XA_PRIMARY, XA_STRING, XdndActionCopy, XdndActionMove, XdndSelection, and XdndStatus.
void Gorgon::WindowManager::handledndselectionnotify | ( | XEvent | event, |
Window & | wind | ||
) |
References Gorgon::WindowManager::internal::getdata().
void Gorgon::WindowManager::handleinputevent | ( | XEvent | event, |
Window & | wind | ||
) |
void Gorgon::WindowManager::handlekeypressevent | ( | XEvent | event, |
Window & | wind | ||
) |
void Gorgon::WindowManager::handlekeyreleaseevent | ( | XEvent | event, |
Window & | wind | ||
) |
void init | ( | ) |
References Monitor::Refresh(), WM_DELETE_WINDOW, XA_ATOM, XA_BMP, XA_CARDINAL, XA_CLIPBOARD, XA_CP_PROP, XA_Filelist, XA_INCR, XA_JPG, XA_NET_ACTIVE_WINDOW, XA_NET_FRAME_EXTENTS, XA_NET_REQUEST_FRAME_EXTENTS, XA_NET_WM_ICON, XA_NET_WM_NAME, XA_NET_WM_STATE, XA_NET_WM_STATE_FULLSCREEN, XA_NET_WM_STATE_HIDDEN, XA_NET_WM_STATE_MAXIMIZED_HORZ, XA_NET_WM_STATE_MAXIMIZED_VERT, XA_NET_WORKAREA, XA_PNG, XA_PRIMARY, XA_PROTOCOLS, XA_STRING, XA_STRUT, XA_TARGETS, XA_TEXT, XA_TEXT_HTML, XA_TIMESTAMP, XA_URL, XA_UTF8_STRING, XA_WM_CHANGE_STATE, XA_WM_NAME, XdndActionCopy, XdndActionMove, XdndAware, XdndDrop, XdndEnter, XdndFinished, XdndLeave, XdndPosition, XdndSelection, XdndStatus, and XdndTypeList.
void Initialize | ( | ) |
Initializes window manager system.
Initializes the filesystem module.
Gorgon system requires every module to have initialization function even if they are not used. Currently used for following tasks:
Set startup directory
There is a mechanism to ensure initialization is performed once.
References init().
Input::Keyboard::Key Gorgon::WindowManager::mapx11key | ( | KeySym | key, |
unsigned int | keycode | ||
) |
References Gorgon::Input::Keyboard::Keycodes::Alt, Gorgon::Input::Keyboard::Keycodes::Backspace, Gorgon::Input::Keyboard::Keycodes::CapsLock, Gorgon::Input::Keyboard::Keycodes::Control, Gorgon::Input::Keyboard::Keycodes::Delete, Gorgon::Input::Keyboard::Keycodes::Down, Gorgon::Input::Keyboard::Keycodes::End, Gorgon::Input::Keyboard::Keycodes::Enter, Gorgon::Input::Keyboard::Keycodes::Escape, Gorgon::Input::Keyboard::Keycodes::F1, Gorgon::Input::Keyboard::Keycodes::F10, Gorgon::Input::Keyboard::Keycodes::F11, Gorgon::Input::Keyboard::Keycodes::F12, Gorgon::Input::Keyboard::Keycodes::F2, Gorgon::Input::Keyboard::Keycodes::F3, Gorgon::Input::Keyboard::Keycodes::F4, Gorgon::Input::Keyboard::Keycodes::F5, Gorgon::Input::Keyboard::Keycodes::F6, Gorgon::Input::Keyboard::Keycodes::F7, Gorgon::Input::Keyboard::Keycodes::F8, Gorgon::Input::Keyboard::Keycodes::F9, Gorgon::Input::Keyboard::Keycodes::Home, Gorgon::Input::Keyboard::Keycodes::Insert, Gorgon::Input::Keyboard::Keycodes::Left, Gorgon::Input::Keyboard::Keycodes::Menu, Gorgon::Input::Keyboard::Keycodes::Meta, Gorgon::Input::Keyboard::Keycodes::Numlock, Gorgon::Input::Keyboard::Keycodes::Numpad_0, Gorgon::Input::Keyboard::Keycodes::Numpad_1, Gorgon::Input::Keyboard::Keycodes::Numpad_2, Gorgon::Input::Keyboard::Keycodes::Numpad_3, Gorgon::Input::Keyboard::Keycodes::Numpad_4, Gorgon::Input::Keyboard::Keycodes::Numpad_5, Gorgon::Input::Keyboard::Keycodes::Numpad_6, Gorgon::Input::Keyboard::Keycodes::Numpad_7, Gorgon::Input::Keyboard::Keycodes::Numpad_8, Gorgon::Input::Keyboard::Keycodes::Numpad_9, Gorgon::Input::Keyboard::Keycodes::Numpad_Decimal, Gorgon::Input::Keyboard::Keycodes::Numpad_Div, Gorgon::Input::Keyboard::Keycodes::Numpad_Enter, Gorgon::Input::Keyboard::Keycodes::Numpad_Minus, Gorgon::Input::Keyboard::Keycodes::Numpad_Mult, Gorgon::Input::Keyboard::Keycodes::Numpad_Plus, Gorgon::Input::Keyboard::Keycodes::OSTransport, Gorgon::Input::Keyboard::Keycodes::PageDown, Gorgon::Input::Keyboard::Keycodes::PageUp, Gorgon::Input::Keyboard::Keycodes::Pause, Gorgon::Input::Keyboard::Keycodes::PrintScreen, Gorgon::Input::Keyboard::Keycodes::RAlt, Gorgon::Input::Keyboard::Keycodes::RControl, Gorgon::Input::Keyboard::Keycodes::Right, Gorgon::Input::Keyboard::Keycodes::RMeta, Gorgon::Input::Keyboard::Keycodes::RShift, Gorgon::Input::Keyboard::Keycodes::ScrollLock, Gorgon::Input::Keyboard::Keycodes::Shift, Gorgon::Input::Keyboard::Keycodes::Space, Gorgon::Input::Keyboard::Keycodes::Tab, and Gorgon::Input::Keyboard::Keycodes::Up.
std::string osgetkeyname | ( | Input::Keyboard::Key | key | ) |
References Gorgon::String::AppendUnicode(), and keysym2ucs().
void SetClipboardBitmap | ( | Containers::Image | img, |
bool | append = false |
||
) |
Changes the clipboard to the given image.
Depending on size of the image, this operation might not work on X11 for now.
References getanywindow(), basic_Image< T_ >::GetMode(), Gorgon::Graphics::HasAlpha(), Gorgon::Containers::PushBackOrUpdate(), XA_BMP, XA_CLIPBOARD, XA_JPG, and XA_PNG.
void SetClipboardList | ( | std::vector< std::string > | list, |
Resource::GID::Type | type = Resource::GID::FileList , |
||
bool | append = false |
||
) |
Sets a list of strings to the clipboard.
URIList can work in some operating systems to copy files from internet resources to other applications. But it is not available in all systems thus it is best to use FileList to copy files.
void SetClipboardText | ( | const std::string & | text, |
Resource::GID::Type | type = Resource::GID::Text , |
||
bool | unicode = true , |
||
bool | append = false |
||
) |
Sets the clipboard text to given string.
May require an existing window. Currently Text and HTML are supported. If append is set, instead of clearing the clipboard, it will add the given text to the list of clipboard data. This function will copy the text, thus is not suitable if the data is too large. If unicode is true, both unicode and regular text would be set to the given data. If you wish to advertise non-unicode text, you should do it after setting unicode text by setting unicode to false and append to true.
std::string Gorgon::WindowManager::xeventname | ( | XEvent & | event | ) |
int ClickThreshold |
The maximum distance allowed for mouse to move between the press of the button and the release for click event to register.
Default value is 5.
Atom WM_DELETE_WINDOW |
Atom XA_ATOM |
Atom XA_BMP |
Atom XA_CARDINAL |
|
extern |
X11 atoms for various data identifiers.
Atom XA_CP_PROP |
Atom XA_Filelist |
Atom XA_INCR |
Atom XA_JPG |
Atom XA_NET_ACTIVE_WINDOW |
Atom XA_NET_FRAME_EXTENTS |
Atom XA_NET_REQUEST_FRAME_EXTENTS |
Atom XA_NET_WM_ICON |
Atom XA_NET_WM_NAME |
Atom XA_NET_WM_STATE |
Atom XA_NET_WM_STATE_ADD |
Atom XA_NET_WM_STATE_FULLSCREEN |
Atom XA_NET_WM_STATE_HIDDEN |
Atom XA_NET_WM_STATE_MAXIMIZED_HORZ |
Atom XA_NET_WM_STATE_MAXIMIZED_VERT |
Atom XA_NET_WORKAREA |
Atom XA_PNG |
Atom XA_PRIMARY |
Atom XA_PROTOCOLS |
Atom XA_STRING |
Atom XA_STRUT |
Atom XA_TARGETS |
Atom XA_TEXT |
Atom XA_TEXT_HTML |
Atom XA_TIMESTAMP |
Atom XA_URL |
Atom XA_UTF8_STRING |
Atom XA_WM_CHANGE_STATE |
Atom XA_WM_NAME |
Atom XdndActionCopy |
Atom XdndActionMove |
Atom XdndAware |
Atom XdndDrop |
Atom XdndEnter |
Atom XdndFinished |
Atom XdndLeave |
Atom XdndPosition |
Atom XdndSelection |
Atom XdndStatus |
Atom XdndTypeList |