Gorgon Game Engine
Gorgon::WindowManager Namespace Reference

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::TypeGetClipboardFormats ()
 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)
 

Variables

int ClickThreshold
 The maximum distance allowed for mouse to move between the press of the button and the release for click event to register. More...
 
Atom XA_CLIPBOARD
 X11 atoms for various data identifiers. More...
 
Atom XA_TIMESTAMP
 
Atom XA_TARGETS
 
Atom XA_PROTOCOLS
 
Atom WM_DELETE_WINDOW
 
Atom XA_TEXT
 
Atom XA_STRING
 
Atom XA_UTF8_STRING
 
Atom XA_TEXT_HTML
 
Atom XA_URL
 
Atom XA_PNG
 
Atom XA_JPG
 
Atom XA_BMP
 
Atom XA_ATOM
 
Atom XA_CARDINAL
 
Atom XA_INCR
 
Atom XA_NET_FRAME_EXTENTS
 
Atom XA_NET_WORKAREA
 
Atom XA_NET_REQUEST_FRAME_EXTENTS
 
Atom XA_WM_NAME
 
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_MAXIMIZED_HORZ
 
Atom XA_NET_WM_STATE_MAXIMIZED_VERT
 
Atom XA_NET_WM_STATE_HIDDEN
 
Atom XA_NET_ACTIVE_WINDOW
 
Atom XA_WM_CHANGE_STATE
 
Atom XA_STRUT
 
Atom XA_NET_WM_ICON
 
Atom XA_PRIMARY
 
Atom XA_CP_PROP
 
Atom XdndAware
 
Atom XdndSelection
 
Atom XdndEnter
 
Atom XdndFinished
 
Atom XdndStatus
 
Atom XdndPosition
 
Atom XdndLeave
 
Atom XdndDrop
 
Atom XdndActionCopy
 
Atom XdndActionMove
 
Atom XdndTypeList
 
Atom XA_Filelist
 

Detailed Description

This namespace contains window manager specific functionality.

This including creating windows, obtaining input, creating graphics context.

Function Documentation

◆ addpadding()

void Gorgon::WindowManager::addpadding ( const Monitor monitor,
int  l,
int  t,
int  r,
int  b 
)

◆ assertkeys()

◆ buttonfromx11()

◆ CurrentContext()

intptr_t CurrentContext ( )

Returns an identifier for the current context.

◆ getanywindow()

::Window Gorgon::WindowManager::getanywindow ( )

◆ GetAtomName()

std::string Gorgon::WindowManager::GetAtomName ( Atom  atom)

◆ GetClipboardBitmap()

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.

◆ GetClipboardFormats()

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:

  • Image_Data: This is a Graphics::Bitmap object, this can be constructed from PNG, JPG, BMP, OS Bitmap formats (BMP, DIB), [Gorgon]Bitmap format which is copied from Graphics::Bitmap. Use GetClipboardBitmap
  • Text: Text data. Use GetClipboardText
  • HTML: HTML data. Use GetClipboardText 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 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.

◆ GetClipboardList()

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.

◆ GetClipboardText()

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.

◆ GetMousePosition()

Geometry::Point Gorgon::WindowManager::GetMousePosition ( Gorgon::internal::windowdata wind)

◆ handlebuttonpressevent()

void Gorgon::WindowManager::handlebuttonpressevent ( XEvent  event,
Window wind 
)

◆ handlebuttonreleaseevent()

void Gorgon::WindowManager::handlebuttonreleaseevent ( XEvent  event,
Window wind 
)

◆ handlednddrop()

void Gorgon::WindowManager::handlednddrop ( XEvent  event,
Window wind 
)

◆ handledndenter()

void Gorgon::WindowManager::handledndenter ( XEvent  event,
Window wind 
)

◆ handledndevent()

void Gorgon::WindowManager::handledndevent ( XEvent  event,
Window wind 
)

◆ handledndleave()

void Gorgon::WindowManager::handledndleave ( XEvent  ,
Window wind 
)

◆ handledndposition()

◆ handledndselectionnotify()

void Gorgon::WindowManager::handledndselectionnotify ( XEvent  event,
Window wind 
)

◆ handleinputevent()

void Gorgon::WindowManager::handleinputevent ( XEvent  event,
Window wind 
)

◆ handlekeypressevent()

◆ handlekeyreleaseevent()

◆ init()

◆ Initialize()

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().

◆ mapx11key()

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.

◆ osgetkeyname()

std::string osgetkeyname ( Input::Keyboard::Key  key)

◆ SetClipboardBitmap()

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.

◆ SetClipboardList()

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.

◆ SetClipboardText()

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.

◆ xeventname()

std::string Gorgon::WindowManager::xeventname ( XEvent &  event)

Variable Documentation

◆ ClickThreshold

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.

◆ WM_DELETE_WINDOW

Atom WM_DELETE_WINDOW

◆ XA_ATOM

Atom XA_ATOM

◆ XA_BMP

Atom XA_BMP

◆ XA_CARDINAL

Atom XA_CARDINAL

◆ XA_CLIPBOARD

Atom XA_CLIPBOARD
extern

X11 atoms for various data identifiers.

◆ XA_CP_PROP

Atom XA_CP_PROP

◆ XA_Filelist

Atom XA_Filelist

◆ XA_INCR

Atom XA_INCR

◆ XA_JPG

Atom XA_JPG

◆ XA_NET_ACTIVE_WINDOW

Atom XA_NET_ACTIVE_WINDOW

◆ XA_NET_FRAME_EXTENTS

Atom XA_NET_FRAME_EXTENTS

◆ XA_NET_REQUEST_FRAME_EXTENTS

Atom XA_NET_REQUEST_FRAME_EXTENTS

◆ XA_NET_WM_ICON

Atom XA_NET_WM_ICON

◆ XA_NET_WM_NAME

Atom XA_NET_WM_NAME

◆ XA_NET_WM_STATE

Atom XA_NET_WM_STATE

◆ XA_NET_WM_STATE_ADD

Atom XA_NET_WM_STATE_ADD

◆ XA_NET_WM_STATE_FULLSCREEN

Atom XA_NET_WM_STATE_FULLSCREEN

◆ XA_NET_WM_STATE_HIDDEN

Atom XA_NET_WM_STATE_HIDDEN

◆ XA_NET_WM_STATE_MAXIMIZED_HORZ

Atom XA_NET_WM_STATE_MAXIMIZED_HORZ

◆ XA_NET_WM_STATE_MAXIMIZED_VERT

Atom XA_NET_WM_STATE_MAXIMIZED_VERT

◆ XA_NET_WORKAREA

Atom XA_NET_WORKAREA

◆ XA_PNG

Atom XA_PNG

◆ XA_PRIMARY

Atom XA_PRIMARY

◆ XA_PROTOCOLS

Atom XA_PROTOCOLS

◆ XA_STRING

Atom XA_STRING

◆ XA_STRUT

Atom XA_STRUT

◆ XA_TARGETS

Atom XA_TARGETS

◆ XA_TEXT

Atom XA_TEXT

◆ XA_TEXT_HTML

Atom XA_TEXT_HTML

◆ XA_TIMESTAMP

Atom XA_TIMESTAMP

◆ XA_URL

Atom XA_URL

◆ XA_UTF8_STRING

Atom XA_UTF8_STRING

◆ XA_WM_CHANGE_STATE

Atom XA_WM_CHANGE_STATE

◆ XA_WM_NAME

Atom XA_WM_NAME

◆ XdndActionCopy

Atom XdndActionCopy

◆ XdndActionMove

Atom XdndActionMove

◆ XdndAware

Atom XdndAware

◆ XdndDrop

Atom XdndDrop

◆ XdndEnter

Atom XdndEnter

◆ XdndFinished

Atom XdndFinished

◆ XdndLeave

Atom XdndLeave

◆ XdndPosition

Atom XdndPosition

◆ XdndSelection

Atom XdndSelection

◆ XdndStatus

Atom XdndStatus

◆ XdndTypeList

Atom XdndTypeList