xfreerdp: removed some weird/unnecessary code

This commit is contained in:
Norbert Federa 2015-04-14 17:59:06 +02:00
parent 98505a0234
commit eb14ab15f5
3 changed files with 21 additions and 49 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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,