1
0
Fork 0
Commit graph

245 commits

Author SHA1 Message Date
c082700891 include/Spectre/Input/Mouse.h rename Button1,Button2 to XButton1 and XButton2
Button1 and Button2 are defined by Xlib. So lets change our ones to avoid headache.
2020-12-28 18:20:55 +01:00
81c7e34c58 Use SPECTRE_PLATFORM_* defines instead of raw compiler ones. 2020-12-26 17:25:25 +01:00
2eec1c9f75 source/Game.cpp: use PlatformApplication::create() 2020-12-26 17:20:30 +01:00
b91b9f3768 Platform/PlatformApplication: adding create() method. 2020-12-26 17:20:05 +01:00
0540f5d201 engine.build.lua: add platform defines. 2020-12-26 15:53:52 +01:00
090646b61a Platform/Unix: Rename X11SharedDisplay to Xlib, and remove Display member variable from all classes.
We now initialize/destroy the display in Xlib::init/shutdown that is called in UnixApplication::init/shutdown and
therefore is valid through the whole lifetime. So no need for classes to keep references.
2020-12-26 15:37:56 +01:00
60dd9bacb0 source/Game.cpp: make sure we call init() and shutdown() for platform 2020-12-26 15:37:57 +01:00
197b4df87f Unix: Remove unnecessary includes of Spectre/Display/DisplayDescription.h 2020-12-23 14:36:52 +01:00
12b2413e23 include/Spectre/Display/DisplayDescription.h: Rename DisplayDecorate::None to Empty (None clashes with X11) 2020-12-23 14:34:12 +01:00
080c4f77c3 Platform/Unix/X11Keyboard: only update state and signal key down if we have a focused window. 2020-12-20 16:29:12 +01:00
6c96a3d9a1 Platform/Unix/X11Mouse.cpp: in isButtonDown() check if we have a focused window. 2020-12-20 16:28:25 +01:00
f71cfa86f2 Platform/Unix/X11Mouse: use X11Display::getFocused() to get the coordinates relative to the focused window. 2020-12-20 16:09:16 +01:00
227d58725d Platform/Unix/X11Display.cpp: Set and unset focused_display variable when the display receives FocusIn/Out events. 2020-12-20 16:03:05 +01:00
d9f54b08ca Platform/Unix/X11Display: Adding getFocused() 2020-12-20 16:01:37 +01:00
d971cd6cb2 Platform/Unix/X11Display.cpp: Capture input focus events (just log for now). 2020-12-20 13:55:56 +01:00
56c24f7118 Platform/Unix/X11Display: Implement missing interface functions.
* getPosition
* setVisible
* minimize
* maximize
* grabCursor (only stub. to get the code to compile)
2020-12-20 13:43:35 +01:00
40e4f95452 Platform/Unix/X11Display.cpp: minor stuff. 2020-12-19 18:55:12 +01:00
0c76864b40 Platform/Unix/X11Display: in setSize() check if width or height is zero before calling XResizeWindow() 2020-12-19 18:55:12 +01:00
50439a58bd source/Platform/Unix/X11Display.cpp: in destroy() make sure m_disp is valid before calling functions that needs it. 2020-12-19 18:55:12 +01:00
0d029817fe source/Platform/Unix/X11Display.cpp: in destroy() call XDestroyWindow() 2020-12-19 18:55:12 +01:00
61b233f708 Platform/Unix/X11Display.cpp: Minor cleanup. 2020-12-19 18:55:12 +01:00
f5d80aa46f Platform/Unix/X11Display: Implement setIcon() 2020-12-19 18:55:12 +01:00
3d9dda64ca Platform/Unix/X11Display: Implement showCursor() 2020-12-19 18:55:12 +01:00
d73c787f40 Platform/Unix/X11SharedDisplay: pass a pointer to the display to XReleaseDisplay() just to be sure client code has a valid pointer 2020-12-19 18:55:11 +01:00
421bf819d5 examples/build.lua: Unix systems needs to link with xrandr. 2020-12-19 18:55:11 +01:00
dfe29acc1e Platform/Unix/UnixMisc.cpp: implement display mode lookups using xrandr extension. 2020-12-19 18:55:11 +01:00
03186ebea0 Platform/Unix/X11EventQueue.cpp: pass ButtonPress/ButtonRelease/MotionNotify events to X11Mouse 2020-12-19 18:55:11 +01:00
816cf3a072 Platform/Unix/X11Mouse: adding a basic implementation to get things going. 2020-12-19 18:55:11 +01:00
cfe064f02c Platform/Unix/X11Keyboard: implement isKeyDown() 2020-12-19 18:55:11 +01:00
7356bdebdd Platform/Unix/X11EventQueue: Fix bug where messeges where not flushed to the event queue.
XEventsQueued(disp, QueuedAlready) only returns the number of events currently in the queue and
does not flush new events. So this must happen elsewhere and if it does not we
will never see any events. i noticed this bug when removing the call to glXSwapBuffers().

Fix this by using XPending() instead as this flushes new events
if the queue is empty before returning the length.

see https://tronche.com/gui/x/xlib/event-handling/XEventsQueued.html
and https://tronche.com/gui/x/xlib/event-handling/XPending.html
2020-12-19 18:55:11 +01:00
4193b3b719 Platform/Unix/X11EventQueue: send KeyPress and KeyRelease events to X11Keyboard::handleMessage() 2020-12-19 18:55:11 +01:00
9954c45fe9 Platform/Unix/X11Keyboard: Implement handleMessage() 2020-12-19 18:55:11 +01:00
30dc11f0d5 Platform/Unix/X11Display.h: Some documentation. 2020-12-19 18:55:11 +01:00
23cf17f9af Platform/Unix/X11EventQueue.cpp: Only process one event per call to poll(). Confirming to Platform API. 2020-12-19 18:55:11 +01:00
7648c23e43 Platform/Unix/X11EventQueue: get and release display handle in constructor/destructor instead of every call to poll()
Should be fine as the display should never change during runtime.
2020-12-19 18:55:11 +01:00
c5648a5105 Platform/Unix/X11EventQueue: redirect unkown events to X11WindowEventHandler. 2020-12-19 18:55:11 +01:00
2b14977eed source/Platform/Unix/X11Display.cpp: register with X11WindowEventHandler 2020-12-19 18:55:11 +01:00
7402896ce6 Adding Platform/Unix/X11WindowEventHandler 2020-12-19 18:55:11 +01:00
7a694e8fd0 Platform/Unix/X11Display: Adding processEvent() to handle resize. 2020-12-19 18:55:11 +01:00
f07be50bd3 source/Platform/Unix/X11Display.cpp: Replace ResizeRedirectMask with StructureNotifyMask
ResizeRedirectMask is broken (will not update the window size). We use StrucutreNotifyMask instead and capture the window size from CaptureNotify event instead.
2020-12-19 18:55:10 +01:00
96b61f0ee3 source/Platform/Unix/X11Display.cpp: in create() call setSize() 2020-12-19 18:55:10 +01:00
9b5bd9dcd0 source/Platform/Unix/X11EventQueue.cpp: post quit event on "WM_DELETE_WINDOW". 2020-12-19 18:55:10 +01:00
035dd333da source/Platform/Unix/X11EventQueue.cpp: log "WM_DESTROY_WINDOW" message. 2020-12-19 18:55:10 +01:00
46bf27f4a4 source/Platform/Unix/X11Display.cpp: call XSetWMProtocols with "WM_DELETE_WINDOW" flag. 2020-12-19 18:55:10 +01:00
d94c7fcf9a Platform/Unix/X11SharedDisplay: adding getAtom() 2020-12-19 18:55:10 +01:00
f8188c4358 source/Platform/Unix/UnixEventQueue.cpp: implement a poll method (only log events for now) 2020-12-19 18:55:10 +01:00
5e27f820de source/Platform/Unix/X11Display.cpp: in create() set the attr.event_mask to include some interesting events. 2020-12-19 18:55:10 +01:00
7dedabba57 source/Platform/Unix/GLXContext: Initial implementation 2020-12-19 18:55:10 +01:00
b65cb9c2d2 source/Platform/Unix/X11Display.cpp: Initial implementation 2020-12-19 18:55:10 +01:00
bd38e9e98f Adding source/Platform/Unix/X11SharedDisplay.cpp 2020-12-19 18:55:10 +01:00