From eb14ab15f5bca5751d8a71965f31509d4c3b176b Mon Sep 17 00:00:00 2001 From: Norbert Federa Date: Tue, 14 Apr 2015 17:59:06 +0200 Subject: [PATCH] xfreerdp: removed some weird/unnecessary code --- client/X11/xf_client.c | 5 ---- client/X11/xf_window.c | 63 ++++++++++++++---------------------------- client/X11/xf_window.h | 2 -- 3 files changed, 21 insertions(+), 49 deletions(-) diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index f017e849c..dbe634513 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -572,9 +572,6 @@ BOOL xf_create_window(xfContext* xfc) xfc->unobscured = (xevent.xvisibility.state == VisibilityUnobscured); - /* Disallow resize now that any initial fullscreen window operation is complete */ - xf_SetWindowSizeHints(xfc, xfc->window, FALSE, xfc->sessionWidth, xfc->sessionHeight); - XSetWMProtocols(xfc->display, xfc->window->handle, &(xfc->WM_DELETE_WINDOW), 1); xfc->drawable = xfc->window->handle; } @@ -685,9 +682,7 @@ void xf_toggle_fullscreen(xfContext* xfc) xfc->fullscreen = (xfc->fullscreen) ? FALSE : TRUE; xfc->decorations = (xfc->fullscreen) ? FALSE : settings->Decorations; - xf_SetWindowSizeHints(xfc, xfc->window, TRUE, xfc->sessionWidth, xfc->sessionHeight); xf_SetWindowFullscreen(xfc, xfc->window, xfc->fullscreen); - xf_SetWindowSizeHints(xfc, xfc->window, FALSE, xfc->sessionWidth, xfc->sessionHeight); EventArgsInit(&e, "xfreerdp"); e.state = xfc->fullscreen ? FREERDP_WINDOW_STATE_FULLSCREEN : 0; diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index fb9b269b1..93589edfb 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -168,7 +168,6 @@ void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen) } XMoveResizeWindow(xfc->display, window->handle, startX, startY, window->width, window->height); - XMapRaised(xfc->display, window->handle); /* Set the fullscreen state */ xf_SendClientEvent(xfc, window->handle, xfc->_NET_WM_STATE, 4, @@ -188,8 +187,6 @@ void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen) xfc->fullscreenMonitors.right, 1); } - - window->fullscreen = fullscreen; } /* http://tronche.com/gui/x/xlib/window-information/XGetWindowProperty.html */ @@ -340,7 +337,6 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int heig window->width = width; window->height = height; - window->fullscreen = FALSE; window->decorations = xfc->decorations; window->is_mapped = FALSE; window->is_transient = FALSE; @@ -395,12 +391,6 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int heig xf_SetWindowDecorations(xfc, window->handle, window->decorations); xf_SetWindowPID(xfc, window->handle, 0); - /* Set the window hints to allow minimal resize, so fullscreen - * changes can work in window managers that might disallow otherwise. - * We will set back afterwards. - */ - xf_SetWindowSizeHints(xfc, window, TRUE, xfc->sessionWidth, xfc->sessionHeight); - input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | VisibilityChangeMask | FocusChangeMask | StructureNotifyMask | @@ -450,46 +440,35 @@ xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int heig } void xf_ResizeDesktopWindow(xfContext* xfc, xfWindow* window, int width, int height) -{ - xf_SetWindowSizeHints(xfc, window, FALSE, width, height); -} - -void xf_SetWindowSizeHints(xfContext* xfc, xfWindow *window, BOOL can_resize, int width, int height) { XSizeHints* size_hints; - size_hints = XAllocSizeHints(); - if (size_hints) - { - size_hints->flags = PMinSize | PMaxSize | PWinGravity; + if (!xfc || !window) + return; - size_hints->win_gravity = NorthWestGravity; - size_hints->min_width = size_hints->max_width = width; - size_hints->min_height = size_hints->max_height = height; + if (!(size_hints = XAllocSizeHints())) + return; + + size_hints->flags = PMinSize | PMaxSize | PWinGravity; + + size_hints->win_gravity = NorthWestGravity; + size_hints->min_width = size_hints->min_height = 1; + size_hints->max_width = size_hints->max_height = 16384; + + XSetWMNormalHints(xfc->display, window->handle, size_hints); + + XResizeWindow(xfc->display, window->handle, width, height); #ifdef WITH_XRENDER - if (xfc->settings->SmartSizing) - { - size_hints->min_width = size_hints->min_height = 1; - size_hints->max_width = size_hints->max_height = 16384; - } + if (!xfc->settings->SmartSizing) #endif - - /* Allows the window to resize larger by 1 pixel - so we can - * fullscreen the window with no worries about window manager disallowing based - * on size parameters - */ - if (can_resize) - { - size_hints->width_inc = size_hints->height_inc = 1; - size_hints->max_width = xfc->sessionWidth + 1; - size_hints->max_height = xfc->sessionHeight + 1; - } - - XSetWMNormalHints(xfc->display, window->handle, size_hints); - XResizeWindow(xfc->display, window->handle, width, height); - XFree(size_hints); + { + size_hints->min_width = size_hints->max_width = width; + size_hints->min_height = size_hints->max_height = height; } + + XSetWMNormalHints(xfc->display, window->handle, size_hints); + XFree(size_hints); } void xf_DestroyDesktopWindow(xfContext* xfc, xfWindow* window) diff --git a/client/X11/xf_window.h b/client/X11/xf_window.h index 2d159d0b6..9120fd1df 100644 --- a/client/X11/xf_window.h +++ b/client/X11/xf_window.h @@ -80,7 +80,6 @@ struct xf_window int shmid; Window handle; Window* xfwin; - BOOL fullscreen; BOOL decorations; BOOL is_mapped; BOOL is_transient; @@ -149,7 +148,6 @@ void xf_SetWindowUnlisted(xfContext* xfc, Window window); xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int height); void xf_ResizeDesktopWindow(xfContext* xfc, xfWindow* window, int width, int height); -void xf_SetWindowSizeHints(xfContext* xfc, xfWindow* window, BOOL can_resize, int width, int height); void xf_DestroyDesktopWindow(xfContext* xfc, xfWindow* window); BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int length,