xfreerdp: process actual desktop window resizing.

This commit is contained in:
Vic Lee 2011-09-06 16:22:53 +08:00
parent 2150325421
commit ccebb5bb3d
3 changed files with 33 additions and 11 deletions

View File

@ -202,7 +202,6 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height)
if (window != NULL)
{
int input_mask;
XSizeHints* size_hints;
XClassHint* class_hints;
window->width = width;
@ -227,16 +226,7 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height)
XFree(class_hints);
}
size_hints = XAllocSizeHints();
if (size_hints)
{
size_hints->flags = PMinSize | PMaxSize;
size_hints->min_width = size_hints->max_width = xfi->width;
size_hints->min_height = size_hints->max_height = xfi->height;
XSetWMNormalHints(xfi->display, window->handle, size_hints);
XFree(size_hints);
}
xf_ResizeDesktopWindow(xfi, window, width, height);
input_mask =
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
@ -250,6 +240,22 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height)
return window;
}
void xf_ResizeDesktopWindow(xfInfo* xfi, xfWindow* window, int width, int height)
{
XSizeHints* size_hints;
size_hints = XAllocSizeHints();
if (size_hints)
{
size_hints->flags = PMinSize | PMaxSize;
size_hints->min_width = size_hints->max_width = xfi->width;
size_hints->min_height = size_hints->max_height = xfi->height;
XSetWMNormalHints(xfi->display, window->handle, size_hints);
XFree(size_hints);
}
}
void xf_FixWindowCoordinates(xfInfo* xfi, int* x, int* y, int* width, int* height)
{
int vscreen_width;

View File

@ -55,6 +55,7 @@ void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, boolean show);
void xf_SetWindowUnlisted(xfInfo* xfi, xfWindow* window);
xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height);
void xf_ResizeDesktopWindow(xfInfo* xfi, xfWindow* window, int width, int height);
xfWindow* xf_CreateWindow(xfInfo* xfi, xfWindow* parent, int x, int y, int width, int height, uint32 id);
void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height);

View File

@ -127,6 +127,20 @@ void xf_end_paint(rdpUpdate* update)
}
}
void xf_desktop_resize(rdpUpdate* update)
{
xfInfo* xfi;
rdpSettings* settings;
xfi = GET_XFI(update);
settings = xfi->instance->settings;
xfi->width = settings->width;
xfi->height = settings->height;
if (xfi->window)
xf_ResizeDesktopWindow(xfi, xfi->window, settings->width, settings->height);
}
boolean xf_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount)
{
xfInfo* xfi = GET_XFI(instance);
@ -393,6 +407,7 @@ boolean xf_post_connect(freerdp* instance)
instance->update->BeginPaint = xf_begin_paint;
instance->update->EndPaint = xf_end_paint;
instance->update->DesktopResize = xf_desktop_resize;
xfi->rail = rail_new(instance->settings);
instance->update->rail = (void*) xfi->rail;