mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 23:07:18 +00:00
[client] x11: properly handle window destruction and fullscreen support
This commit is contained in:
parent
973806dd9c
commit
06af101bf9
@ -74,6 +74,8 @@ struct X11DSState
|
|||||||
Atom aNetFrameExtents;
|
Atom aNetFrameExtents;
|
||||||
Atom aNetWMState;
|
Atom aNetWMState;
|
||||||
Atom aNetWMStateFullscreen;
|
Atom aNetWMStateFullscreen;
|
||||||
|
Atom aNetWMWindowType;
|
||||||
|
Atom aNetWMWindowTypeNormal;
|
||||||
|
|
||||||
// clipboard members
|
// clipboard members
|
||||||
Atom aSelection;
|
Atom aSelection;
|
||||||
@ -201,9 +203,35 @@ static bool x11Init(const LG_DSInitParams params)
|
|||||||
XInternAtom(x11.display, "_NET_WM_STATE", True);
|
XInternAtom(x11.display, "_NET_WM_STATE", True);
|
||||||
x11.aNetWMStateFullscreen =
|
x11.aNetWMStateFullscreen =
|
||||||
XInternAtom(x11.display, "_NET_WM_STATE_FULLSCREEN", True);
|
XInternAtom(x11.display, "_NET_WM_STATE_FULLSCREEN", True);
|
||||||
|
x11.aNetWMWindowType =
|
||||||
|
XInternAtom(x11.display, "_NET_WM_WINDOW_TYPE", True);
|
||||||
|
x11.aNetWMWindowTypeNormal =
|
||||||
|
XInternAtom(x11.display, "_NET_WM_WINDOW_TYPE_NORMAL", True);
|
||||||
|
|
||||||
|
XChangeProperty(
|
||||||
|
x11.display,
|
||||||
|
x11.window,
|
||||||
|
x11.aNetWMWindowType,
|
||||||
|
XA_CARDINAL,
|
||||||
|
32,
|
||||||
|
PropModeReplace,
|
||||||
|
(unsigned char *)&x11.aNetWMWindowTypeNormal,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
if (params.fullscreen)
|
if (params.fullscreen)
|
||||||
x11SetFullscreen(true);
|
{
|
||||||
|
XChangeProperty(
|
||||||
|
x11.display,
|
||||||
|
x11.window,
|
||||||
|
x11.aNetWMState,
|
||||||
|
XA_CARDINAL,
|
||||||
|
32,
|
||||||
|
PropModeReplace,
|
||||||
|
(unsigned char *)&x11.aNetWMStateFullscreen,
|
||||||
|
1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (x11.aNetReqFrameExtents)
|
if (x11.aNetReqFrameExtents)
|
||||||
{
|
{
|
||||||
@ -395,7 +423,9 @@ static void x11Free(void)
|
|||||||
{
|
{
|
||||||
lgJoinThread(x11.eventThread, NULL);
|
lgJoinThread(x11.eventThread, NULL);
|
||||||
|
|
||||||
|
if (x11.window)
|
||||||
XDestroyWindow(x11.display, x11.window);
|
XDestroyWindow(x11.display, x11.window);
|
||||||
|
|
||||||
XFreeCursor(x11.display, x11.squareCursor);
|
XFreeCursor(x11.display, x11.squareCursor);
|
||||||
XFreeCursor(x11.display, x11.blankCursor);
|
XFreeCursor(x11.display, x11.blankCursor);
|
||||||
XCloseDisplay(x11.display);
|
XCloseDisplay(x11.display);
|
||||||
@ -478,6 +508,15 @@ static int x11EventThread(void * unused)
|
|||||||
|
|
||||||
switch(xe.type)
|
switch(xe.type)
|
||||||
{
|
{
|
||||||
|
case DestroyNotify:
|
||||||
|
if (xe.xdestroywindow.display == x11.display &&
|
||||||
|
xe.xdestroywindow.window == x11.window)
|
||||||
|
{
|
||||||
|
x11.window = 0;
|
||||||
|
app_handleCloseEvent();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
Loading…
Reference in New Issue
Block a user