Merge pull request #2547 from nfedera/fix-2015-04-16-01

Fullscreen fixes and smart sizing resuscitation
This commit is contained in:
Marc-André Moreau 2015-04-17 09:03:46 -04:00
commit 2e80e325d3
8 changed files with 156 additions and 158 deletions

View File

@ -128,14 +128,14 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
return;
}
if (xfc->width <= 0 || xfc->height <= 0)
if (xfc->sessionWidth <= 0 || xfc->sessionHeight <= 0)
{
WLog_ERR(TAG, "the window dimensions are invalid");
return;
}
xScalingFactor = xfc->width / (double)xfc->scaledWidth;
yScalingFactor = xfc->height / (double)xfc->scaledHeight;
xScalingFactor = xfc->sessionWidth / (double)xfc->scaledWidth;
yScalingFactor = xfc->sessionHeight / (double)xfc->scaledHeight;
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XSetForeground(xfc->display, xfc->gc, 0);
@ -195,8 +195,8 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
BOOL xf_picture_transform_required(xfContext* xfc)
{
if (xfc->offset_x || xfc->offset_y ||
xfc->scaledWidth != xfc->width ||
xfc->scaledHeight != xfc->height)
xfc->scaledWidth != xfc->sessionWidth ||
xfc->scaledHeight != xfc->sessionHeight)
{
return TRUE;
}
@ -232,7 +232,7 @@ static void xf_desktop_resize(rdpContext* context)
{
BOOL same = (xfc->primary == xfc->drawing) ? TRUE : FALSE;
XFreePixmap(xfc->display, xfc->primary);
xfc->primary = XCreatePixmap(xfc->display, xfc->drawable, xfc->width, xfc->height, xfc->depth);
xfc->primary = XCreatePixmap(xfc->display, xfc->drawable, xfc->sessionWidth, xfc->sessionHeight, xfc->depth);
if (same)
xfc->drawing = xfc->primary;
}
@ -240,18 +240,26 @@ static void xf_desktop_resize(rdpContext* context)
#ifdef WITH_XRENDER
if (!xfc->settings->SmartSizing)
{
xfc->scaledWidth = xfc->width;
xfc->scaledHeight = xfc->height;
xfc->scaledWidth = xfc->sessionWidth;
xfc->scaledHeight = xfc->sessionHeight;
}
#endif
if (!xfc->fullscreen)
{
if (xfc->window)
xf_ResizeDesktopWindow(xfc, xfc->window, settings->DesktopWidth, settings->DesktopHeight);
xf_ResizeDesktopWindow(xfc, xfc->window, settings->DesktopWidth, settings->DesktopHeight);
}
else
{
#ifdef WITH_XRENDER
if (!xfc->settings->SmartSizing)
#endif
{
/* Update the saved width and height values the window will be
* resized to when toggling out of fullscreen */
xfc->savedWidth = xfc->sessionWidth;
xfc->savedHeight = xfc->sessionHeight;
}
XSetFunction(xfc->display, xfc->gc, GXcopy);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XSetForeground(xfc->display, xfc->gc, 0);
@ -343,10 +351,10 @@ void xf_sw_desktop_resize(rdpContext* context)
xf_lock_x11(xfc, TRUE);
xfc->width = context->settings->DesktopWidth;
xfc->height = context->settings->DesktopHeight;
xfc->sessionWidth = context->settings->DesktopWidth;
xfc->sessionHeight = context->settings->DesktopHeight;
gdi_resize(gdi, xfc->width, xfc->height);
gdi_resize(gdi, xfc->sessionWidth, xfc->sessionHeight);
if (xfc->image)
{
@ -447,8 +455,8 @@ void xf_hw_desktop_resize(rdpContext* context)
xf_lock_x11(xfc, TRUE);
xfc->width = settings->DesktopWidth;
xfc->height = settings->DesktopHeight;
xfc->sessionWidth = settings->DesktopWidth;
xfc->sessionHeight = settings->DesktopHeight;
xf_desktop_resize(context);
@ -503,10 +511,8 @@ BOOL xf_create_window(xfContext* xfc)
ZeroMemory(&xevent, sizeof(xevent));
xf_detect_monitors(xfc);
width = xfc->width;
height = xfc->height;
width = xfc->sessionWidth;
height = xfc->sessionHeight;
if (!xfc->hdc)
xfc->hdc = gdi_CreateDC(CLRBUF_32BPP, xfc->bpp);
@ -541,30 +547,13 @@ BOOL xf_create_window(xfContext* xfc)
sprintf(windowTitle, "FreeRDP: %s:%i", settings->ServerHostname, settings->ServerPort);
}
if (xfc->fullscreen)
{
width = xfc->desktopWidth;
height = xfc->desktopHeight;
}
#ifdef WITH_XRENDER
if (settings->SmartSizing)
if (settings->SmartSizing && !xfc->fullscreen)
{
if (xfc->fullscreen)
{
if (xfc->window)
{
settings->SmartSizingWidth = xfc->window->width;
settings->SmartSizingHeight = xfc->window->height;
}
}
else
{
if (settings->SmartSizingWidth)
width = settings->SmartSizingWidth;
if (settings->SmartSizingHeight)
height = settings->SmartSizingHeight;
}
if (settings->SmartSizingWidth)
width = settings->SmartSizingWidth;
if (settings->SmartSizingHeight)
height = settings->SmartSizingHeight;
xfc->scaledWidth = width;
xfc->scaledHeight = height;
@ -580,9 +569,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->width, xfc->height);
XSetWMProtocols(xfc->display, xfc->window->handle, &(xfc->WM_DELETE_WINDOW), 1);
xfc->drawable = xfc->window->handle;
}
@ -600,7 +586,7 @@ BOOL xf_create_window(xfContext* xfc)
assert(!xfc->gc);
xfc->gc = XCreateGC(xfc->display, xfc->drawable, GCGraphicsExposures, &gcv);
assert(!xfc->primary);
xfc->primary = XCreatePixmap(xfc->display, xfc->drawable, xfc->width, xfc->height, xfc->depth);
xfc->primary = XCreatePixmap(xfc->display, xfc->drawable, xfc->sessionWidth, xfc->sessionHeight, xfc->depth);
xfc->drawing = xfc->primary;
assert(!xfc->bitmap_mono);
xfc->bitmap_mono = XCreatePixmap(xfc->display, xfc->drawable, 8, 8, 1);
@ -609,12 +595,12 @@ BOOL xf_create_window(xfContext* xfc)
XSetFunction(xfc->display, xfc->gc, GXcopy);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XSetForeground(xfc->display, xfc->gc, BlackPixelOfScreen(xfc->screen));
XFillRectangle(xfc->display, xfc->primary, xfc->gc, 0, 0, xfc->width, xfc->height);
XFillRectangle(xfc->display, xfc->primary, xfc->gc, 0, 0, xfc->sessionWidth, xfc->sessionHeight);
XFlush(xfc->display);
assert(!xfc->image);
xfc->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
(char*) xfc->primary_buffer, xfc->width, xfc->height, xfc->scanline_pad, 0);
(char*) xfc->primary_buffer, xfc->sessionWidth, xfc->sessionHeight, xfc->scanline_pad, 0);
return TRUE;
}
@ -693,9 +679,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->width, xfc->height);
xf_SetWindowFullscreen(xfc, xfc->window, xfc->fullscreen);
xf_SetWindowSizeHints(xfc, xfc->window, FALSE, xfc->width, xfc->height);
EventArgsInit(&e, "xfreerdp");
e.state = xfc->fullscreen ? FREERDP_WINDOW_STATE_FULLSCREEN : 0;
@ -943,6 +927,9 @@ BOOL xf_pre_connect(freerdp* instance)
rdpSettings* settings;
rdpContext* context = instance->context;
xfContext* xfc = (xfContext*) instance->context;
UINT32 maxWidth = 0;
UINT32 maxHeight = 0;
xfc->codecs = context->codecs;
xfc->settings = instance->settings;
@ -1016,9 +1003,26 @@ BOOL xf_pre_connect(freerdp* instance)
xf_keyboard_init(xfc);
xf_detect_monitors(xfc);
settings->DesktopWidth = xfc->desktopWidth;
settings->DesktopHeight = xfc->desktopHeight;
xf_detect_monitors(xfc, &maxWidth, &maxHeight);
if (maxWidth && maxHeight)
{
settings->DesktopWidth = maxWidth;
settings->DesktopHeight = maxHeight;
}
#ifdef WITH_XRENDER
/**
* If /f is specified in combination with /smart-sizing:widthxheight then
* we run the session in the /smart-sizing dimensions scaled to full screen
*/
if (settings->Fullscreen && settings->SmartSizing &&
settings->SmartSizingWidth && settings->SmartSizingHeight)
{
settings->DesktopWidth = settings->SmartSizingWidth;
settings->DesktopHeight = settings->SmartSizingHeight;
}
#endif
xfc->fullscreen = settings->Fullscreen;
xfc->decorations = settings->Decorations;
@ -1074,12 +1078,12 @@ BOOL xf_post_connect(freerdp* instance)
xf_gdi_register_update_callbacks(update);
}
xfc->width = settings->DesktopWidth;
xfc->height = settings->DesktopHeight;
xfc->sessionWidth = settings->DesktopWidth;
xfc->sessionHeight = settings->DesktopHeight;
#ifdef WITH_XRENDER
xfc->scaledWidth = xfc->width;
xfc->scaledHeight = xfc->height;
xfc->scaledWidth = xfc->sessionWidth;
xfc->scaledHeight = xfc->sessionHeight;
xfc->offset_x = 0;
xfc->offset_y = 0;
#endif
@ -1557,7 +1561,7 @@ static void xf_ZoomingChangeEventHandler(rdpContext* context, ZoomingChangeEvent
xfc->scaledWidth = w;
xfc->scaledHeight = h;
xf_draw_screen(xfc, 0, 0, xfc->width, xfc->height);
xf_draw_screen(xfc, 0, 0, xfc->sessionWidth, xfc->sessionHeight);
}
static void xf_PanningChangeEventHandler(rdpContext* context, PanningChangeEventArgs* e)
@ -1570,7 +1574,7 @@ static void xf_PanningChangeEventHandler(rdpContext* context, PanningChangeEvent
xfc->offset_x += e->dx;
xfc->offset_y += e->dy;
xf_draw_screen(xfc, 0, 0, xfc->width, xfc->height);
xf_draw_screen(xfc, 0, 0, xfc->sessionWidth, xfc->sessionHeight);
}
#endif

View File

@ -185,8 +185,8 @@ void xf_event_adjust_coordinates(xfContext* xfc, int* x, int *y)
#ifdef WITH_XRENDER
if (xf_picture_transform_required(xfc))
{
double xScalingFactor = xfc->width / (double)xfc->scaledWidth;
double yScalingFactor = xfc->height / (double)xfc->scaledHeight;
double xScalingFactor = xfc->sessionWidth / (double)xfc->scaledWidth;
double yScalingFactor = xfc->sessionHeight / (double)xfc->scaledHeight;
*x = (int)((*x - xfc->offset_x) * xScalingFactor);
*y = (int)((*y - xfc->offset_y) * yScalingFactor);
}
@ -204,8 +204,8 @@ static BOOL xf_event_Expose(xfContext* xfc, XEvent* event, BOOL app)
{
x = 0;
y = 0;
w = xfc->width;
h = xfc->height;
w = xfc->sessionWidth;
h = xfc->sessionHeight;
}
else
{
@ -642,6 +642,12 @@ static BOOL xf_event_ConfigureNotify(xfContext* xfc, XEvent* event, BOOL app)
if (!app)
{
if (xfc->window->left != event->xconfigure.x)
xfc->window->left = event->xconfigure.x;
if (xfc->window->top != event->xconfigure.y)
xfc->window->top = event->xconfigure.y;
if (xfc->window->width != event->xconfigure.width ||
xfc->window->height != event->xconfigure.height)
{
@ -652,17 +658,14 @@ static BOOL xf_event_ConfigureNotify(xfContext* xfc, XEvent* event, BOOL app)
xfc->offset_y = 0;
if (xfc->settings->SmartSizing || xfc->settings->MultiTouchGestures)
{
if (!xfc->fullscreen)
{
xfc->scaledWidth = xfc->window->width;
xfc->scaledHeight = xfc->window->height;
}
xf_draw_screen(xfc, 0, 0, xfc->width, xfc->height);
xfc->scaledWidth = xfc->window->width;
xfc->scaledHeight = xfc->window->height;
xf_draw_screen(xfc, 0, 0, xfc->sessionWidth, xfc->sessionHeight);
}
else
{
xfc->scaledWidth = xfc->width;
xfc->scaledHeight = xfc->height;
xfc->scaledWidth = xfc->sessionWidth;
xfc->scaledHeight = xfc->sessionHeight;
}
#endif
}
@ -718,8 +721,8 @@ static BOOL xf_event_MapNotify(xfContext* xfc, XEvent* event, BOOL app)
{
rect.left = 0;
rect.top = 0;
rect.right = xfc->width;
rect.bottom = xfc->height;
rect.right = xfc->sessionWidth;
rect.bottom = xfc->sessionHeight;
update->SuppressOutput((rdpContext*) xfc, 1, &rect);
}

View File

@ -490,16 +490,16 @@ BOOL xf_keyboard_handle_special_keys(xfContext* xfc, KeySym keysym)
switch(keysym)
{
case XK_0: /* Ctrl-Alt-0: Reset scaling and panning */
xfc->scaledWidth = xfc->width;
xfc->scaledHeight = xfc->height;
xfc->scaledWidth = xfc->sessionWidth;
xfc->scaledHeight = xfc->sessionHeight;
xfc->offset_x = 0;
xfc->offset_y = 0;
if (!xfc->fullscreen && (xfc->width != xfc->window->width ||
xfc->height != xfc->window->height))
if (!xfc->fullscreen && (xfc->sessionWidth != xfc->window->width ||
xfc->sessionHeight != xfc->window->height))
{
xf_ResizeDesktopWindow(xfc, xfc->window, xfc->width, xfc->height);
xf_ResizeDesktopWindow(xfc, xfc->window, xfc->sessionWidth, xfc->sessionHeight);
}
xf_draw_screen(xfc, 0, 0, xfc->width, xfc->height);
xf_draw_screen(xfc, 0, 0, xfc->sessionWidth, xfc->sessionHeight);
return TRUE;
case XK_1: /* Ctrl-Alt-1: Zoom in */

View File

@ -115,13 +115,12 @@ BOOL xf_is_monitor_id_active(xfContext* xfc, UINT32 id)
return FALSE;
}
BOOL xf_detect_monitors(xfContext* xfc)
BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
{
int i;
int nmonitors = 0;
int primaryMonitorFound = FALSE;
int vX, vY, vWidth, vHeight;
int maxWidth, maxHeight;
VIRTUAL_SCREEN* vscreen;
rdpSettings* settings = xfc->settings;
@ -135,8 +134,8 @@ BOOL xf_detect_monitors(xfContext* xfc)
#endif
vscreen = &xfc->vscreen;
xfc->desktopWidth = settings->DesktopWidth;
xfc->desktopHeight = settings->DesktopHeight;
*pMaxWidth = settings->DesktopWidth;
*pMaxHeight = settings->DesktopHeight;
/* get mouse location */
if (!XQueryPointer(xfc->display, DefaultRootWindow(xfc->display),
@ -195,39 +194,27 @@ BOOL xf_detect_monitors(xfContext* xfc)
if (settings->Fullscreen)
{
xfc->desktopWidth = WidthOfScreen(xfc->screen);
xfc->desktopHeight = HeightOfScreen(xfc->screen);
maxWidth = xfc->desktopWidth;
maxHeight = xfc->desktopHeight;
*pMaxWidth = WidthOfScreen(xfc->screen);
*pMaxHeight = HeightOfScreen(xfc->screen);
}
else if (settings->Workarea)
{
xfc->desktopWidth = xfc->workArea.width;
xfc->desktopHeight = xfc->workArea.height;
maxWidth = xfc->desktopWidth;
maxHeight = xfc->desktopHeight;
*pMaxWidth = xfc->workArea.width;
*pMaxHeight = xfc->workArea.height;
}
else if (settings->PercentScreen)
{
xfc->desktopWidth = (xfc->workArea.width * settings->PercentScreen) / 100;
xfc->desktopHeight = (xfc->workArea.height * settings->PercentScreen) / 100;
*pMaxWidth = (xfc->workArea.width * settings->PercentScreen) / 100;
*pMaxHeight = (xfc->workArea.height * settings->PercentScreen) / 100;
/* If we have specific monitor information then limit the PercentScreen value
* to only affect the current monitor vs. the entire desktop
*/
if (vscreen->nmonitors > 0)
{
settings->DesktopWidth = ((vscreen->monitors[current_monitor].area.right - vscreen->monitors[current_monitor].area.left + 1) * settings->PercentScreen) / 100;
settings->DesktopHeight = ((vscreen->monitors[current_monitor].area.bottom - vscreen->monitors[current_monitor].area.top + 1) * settings->PercentScreen) / 100;
*pMaxWidth = ((vscreen->monitors[current_monitor].area.right - vscreen->monitors[current_monitor].area.left + 1) * settings->PercentScreen) / 100;
*pMaxHeight = ((vscreen->monitors[current_monitor].area.bottom - vscreen->monitors[current_monitor].area.top + 1) * settings->PercentScreen) / 100;
}
maxWidth = xfc->desktopWidth;
maxHeight = xfc->desktopHeight;
}
else
{
maxWidth = WidthOfScreen(xfc->screen);
maxHeight = HeightOfScreen(xfc->screen);
}
if (!settings->Fullscreen && !settings->Workarea && !settings->UseMultimon)
@ -258,8 +245,8 @@ BOOL xf_detect_monitors(xfContext* xfc)
settings->MonitorDefArray[nmonitors].x = vscreen->monitors[i].area.left;
settings->MonitorDefArray[nmonitors].y = vscreen->monitors[i].area.top;
settings->MonitorDefArray[nmonitors].width = MIN(vscreen->monitors[i].area.right - vscreen->monitors[i].area.left + 1, xfc->desktopWidth);
settings->MonitorDefArray[nmonitors].height = MIN(vscreen->monitors[i].area.bottom - vscreen->monitors[i].area.top + 1, xfc->desktopHeight);
settings->MonitorDefArray[nmonitors].width = MIN(vscreen->monitors[i].area.right - vscreen->monitors[i].area.left + 1, *pMaxWidth);
settings->MonitorDefArray[nmonitors].height = MIN(vscreen->monitors[i].area.bottom - vscreen->monitors[i].area.top + 1, *pMaxHeight);
settings->MonitorDefArray[nmonitors].orig_screen = i;
nmonitors++;
@ -270,8 +257,8 @@ BOOL xf_detect_monitors(xfContext* xfc)
{
settings->MonitorDefArray[0].x = vscreen->monitors[current_monitor].area.left;
settings->MonitorDefArray[0].y = vscreen->monitors[current_monitor].area.top;
settings->MonitorDefArray[0].width = MIN(vscreen->monitors[current_monitor].area.right - vscreen->monitors[current_monitor].area.left + 1, xfc->desktopWidth);
settings->MonitorDefArray[0].height = MIN(vscreen->monitors[current_monitor].area.bottom - vscreen->monitors[current_monitor].area.top + 1, xfc->desktopHeight);
settings->MonitorDefArray[0].width = MIN(vscreen->monitors[current_monitor].area.right - vscreen->monitors[current_monitor].area.left + 1, *pMaxWidth);
settings->MonitorDefArray[0].height = MIN(vscreen->monitors[current_monitor].area.bottom - vscreen->monitors[current_monitor].area.top + 1, *pMaxHeight);
settings->MonitorDefArray[0].orig_screen = current_monitor;
nmonitors = 1;
@ -368,8 +355,8 @@ BOOL xf_detect_monitors(xfContext* xfc)
}
/* Set the desktop width and height according to the bounding rectangle around the active monitors */
xfc->desktopWidth = vscreen->area.right - vscreen->area.left + 1;
xfc->desktopHeight = vscreen->area.bottom - vscreen->area.top + 1;
*pMaxWidth = vscreen->area.right - vscreen->area.left + 1;
*pMaxHeight = vscreen->area.bottom - vscreen->area.top + 1;
}
return TRUE;

View File

@ -44,7 +44,7 @@ typedef struct _VIRTUAL_SCREEN VIRTUAL_SCREEN;
#include "xfreerdp.h"
FREERDP_API int xf_list_monitors(xfContext* xfc);
FREERDP_API BOOL xf_detect_monitors(xfContext* xfc);
FREERDP_API BOOL xf_detect_monitors(xfContext* xfc, UINT32* pWidth, UINT32* pHeight);
FREERDP_API void xf_monitors_free(xfContext* xfc);
#endif /* __XF_MONITOR_H */

View File

@ -140,14 +140,33 @@ void xf_SendClientEvent(xfContext* xfc, Window window, Atom atom, unsigned int n
void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen)
{
int i;
int startX = xfc->instance->settings->DesktopPosX;
int startY = xfc->instance->settings->DesktopPosY;
rdpSettings* settings = xfc->settings;
int startX, startY;
UINT32 width = window->width;
UINT32 height = window->height;
window->decorations = xfc->decorations;
xf_SetWindowDecorations(xfc, window->handle, window->decorations);
if (fullscreen)
{
xfc->savedWidth = xfc->window->width;
xfc->savedHeight = xfc->window->height;
xfc->savedPosX = xfc->window->left;
xfc->savedPosY = xfc->window->top;
startX = settings->DesktopPosX;
startY = settings->DesktopPosY;
}
else
{
width = xfc->savedWidth;
height = xfc->savedHeight;
startX = xfc->savedPosX;
startY = xfc->savedPosY;
}
/* Determine the x,y starting location for the fullscreen window */
if (xfc->instance->settings->MonitorCount)
if (fullscreen && xfc->instance->settings->MonitorCount)
{
/* Initialize startX and startY with reasonable values */
startX = xfc->instance->settings->MonitorDefArray[0].x;
@ -167,8 +186,7 @@ void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen)
startY = startY + xfc->instance->settings->MonitorLocalShiftY;
}
XMoveResizeWindow(xfc->display, window->handle, startX, startY, window->width, window->height);
XMapRaised(xfc->display, window->handle);
xf_ResizeDesktopWindow(xfc, window, width, height);
/* Set the fullscreen state */
xf_SendClientEvent(xfc, window->handle, xfc->_NET_WM_STATE, 4,
@ -189,7 +207,7 @@ void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen)
1);
}
window->fullscreen = TRUE;
XMoveWindow(xfc->display, window->handle, startX, startY);
}
/* http://tronche.com/gui/x/xlib/window-information/XGetWindowProperty.html */
@ -340,7 +358,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 +412,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->width, xfc->height);
input_mask =
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
VisibilityChangeMask | FocusChangeMask | StructureNotifyMask |
@ -450,46 +461,38 @@ 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)
{
if (!xfc->fullscreen)
{
size_hints->width_inc = size_hints->height_inc = 1;
size_hints->max_width = xfc->width + 1;
size_hints->max_height = xfc->height + 1;
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);
}
XSetWMNormalHints(xfc->display, window->handle, size_hints);
XResizeWindow(xfc->display, window->handle, width, height);
XFree(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,

View File

@ -92,8 +92,8 @@ struct xf_context
int bpp;
int xfds;
int depth;
int width;
int height;
int sessionWidth;
int sessionHeight;
int srcBpp;
GC gc_mono;
BOOL invert;
@ -151,6 +151,11 @@ struct xf_context
int XInputOpcode;
int savedWidth;
int savedHeight;
int savedPosX;
int savedPosY;
#ifdef WITH_XRENDER
int scaledWidth;
int scaledHeight;
@ -171,8 +176,6 @@ struct xf_context
wArrayList* xevents;
char* actionScript;
UINT32 desktopWidth;
UINT32 desktopHeight;
XSetWindowAttributes attribs;
BOOL complex_regions;
VIRTUAL_SCREEN vscreen;