xfreerdp: fix drawing of maximized RAIL windows

This commit is contained in:
Marc-André Moreau 2011-08-22 21:22:05 -04:00
parent c894806ee9
commit cfd3407f69
6 changed files with 81 additions and 31 deletions

View File

@ -93,15 +93,14 @@ boolean xf_event_Expose(xfInfo* xfi, XEvent* event, boolean app)
xfw = (xfWindow*) window->extra;
XPutImage(xfi->display, xfi->primary, xfw->gc, xfi->image,
window->windowOffsetX, window->windowOffsetY,
window->windowOffsetX, window->windowOffsetY,
window->windowWidth, window->windowHeight);
xfw->left, xfw->top, xfw->left, xfw->top, xfw->width, xfw->height);
XCopyArea(xfi->display, xfi->primary, xfw->handle, xfw->gc,
window->windowOffsetX, window->windowOffsetY,
window->windowWidth, window->windowHeight, 0, 0);
xfw->left, xfw->top, xfw->width, xfw->height, 0, 0);
XFlush(xfi->display);
xfw = (xfWindow*) window->extra;
}
}
@ -178,7 +177,7 @@ boolean xf_event_ButtonPress(xfInfo* xfi, XEvent* event, boolean app)
case 5:
wheel = True;
flags = PTR_FLAGS_WHEEL | 0x0088;
flags = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
break;
default:
@ -198,13 +197,15 @@ boolean xf_event_ButtonPress(xfInfo* xfi, XEvent* event, boolean app)
{
if (app)
{
xfWindow* xfw;
rdpWindow* window;
window = window_list_get_by_extra_id(xfi->rail->list, (void*) event->xbutton.window);
if (window != NULL)
{
x += window->windowOffsetX;
y += window->windowOffsetY;
xfw = (xfWindow*) window->extra;
x += xfw->left;
y += xfw->top;
}
}
@ -256,13 +257,15 @@ boolean xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, boolean app)
{
if (app)
{
xfWindow* xfw;
rdpWindow* window;
window = window_list_get_by_extra_id(xfi->rail->list, (void*) event->xany.window);
if (window != NULL)
{
x += window->windowOffsetX;
y += window->windowOffsetY;
xfw = (xfWindow*) window->extra;
x += xfw->left;
y += xfw->top;
}
}
@ -406,13 +409,10 @@ boolean xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, boolean app)
xfw = (xfWindow*) window->extra;
XPutImage(xfi->display, xfi->primary, xfw->gc, xfi->image,
window->windowOffsetX, window->windowOffsetY,
window->windowOffsetX, window->windowOffsetY,
window->windowWidth, window->windowHeight);
xfw->left, xfw->top, xfw->left, xfw->top, xfw->width, xfw->height);
XCopyArea(xfi->display, xfi->primary, xfw->handle, xfw->gc,
window->windowOffsetX, window->windowOffsetY,
window->windowWidth, window->windowHeight, 0, 0);
xfw->left, xfw->top, xfw->width, xfw->height, 0, 0);
XFlush(xfi->display);
}

View File

@ -41,10 +41,10 @@ void xf_rail_paint(xfInfo* xfi, rdpRail* rail, uint32 ileft, uint32 itop, uint32
window = window_list_get_next(rail->list);
xfw = (xfWindow*) window->extra;
wleft = window->windowOffsetX;
wtop = window->windowOffsetY;
wright = window->windowOffsetX + window->windowWidth - 1;
wbottom = window->windowOffsetY + window->windowHeight - 1;
wleft = xfw->left;
wtop = xfw->top;
wright = xfw->right;
wbottom = xfw->bottom;
intersect = ((iright > wleft) && (ileft < wright) &&
(ibottom > wtop) && (itop < wbottom)) ? True : False;
@ -63,8 +63,7 @@ void xf_rail_paint(xfInfo* xfi, rdpRail* rail, uint32 ileft, uint32 itop, uint32
XCopyArea(xfi->display, xfi->primary, xfw->handle, xfw->gc,
uleft, utop, uwidth, uheight,
uleft - window->windowOffsetX,
utop - window->windowOffsetY);
uleft - xfw->left, utop - xfw->top);
}
}
@ -79,8 +78,7 @@ void xf_rail_CreateWindow(rdpRail* rail, rdpWindow* window)
xfi = (xfInfo*) rail->extra;
xfw = xf_CreateWindow((xfInfo*) rail->extra,
window->windowOffsetX + xfi->workArea.x,
window->windowOffsetY + xfi->workArea.y,
window->windowOffsetX, window->windowOffsetY,
window->windowWidth, window->windowHeight,
window->windowId);
@ -99,8 +97,7 @@ void xf_rail_MoveWindow(rdpRail* rail, rdpWindow* window)
xfw = (xfWindow*) window->extra;
xf_MoveWindow((xfInfo*) rail->extra, xfw,
window->windowOffsetX + xfi->workArea.x,
window->windowOffsetY + xfi->workArea.y,
window->windowOffsetX, window->windowOffsetY,
window->windowWidth, window->windowHeight);
}

View File

@ -206,6 +206,20 @@ xfWindow* desktop_create(xfInfo* xfi, char* name)
return window;
}
void xf_fix_window_coordinates(int* x, int* y, int* width, int* height)
{
if (*x < 0)
{
*width += *x;
*x = 0;
}
if (*y < 0)
{
*height += *y;
*y = 0;
}
}
char rail_window_class[] = "RAIL:00000000";
xfWindow* xf_CreateWindow(xfInfo* xfi, int x, int y, int width, int height, uint32 id)
@ -214,6 +228,15 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, int x, int y, int width, int height, uint
window = (xfWindow*) xzalloc(sizeof(xfWindow));
if ((width * height) < 1)
return NULL;
xf_fix_window_coordinates(&x, &y, &width, &height);
window->left = x;
window->top = y;
window->right = x + width - 1;
window->bottom = y + height - 1;
window->width = width;
window->height = height;
@ -285,6 +308,8 @@ void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int h
if ((width * height) < 1)
return;
xf_fix_window_coordinates(&x, &y, &width, &height);
size_hints = XAllocSizeHints();
if (size_hints)
@ -298,7 +323,7 @@ void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int h
if (window->width == width && window->height == height)
XMoveWindow(xfi->display, window->handle, x, y);
else if (window->x == x && window->y == y)
else if (window->left == x && window->top == y)
XResizeWindow(xfi->display, window->handle, width, height);
else
XMoveResizeWindow(xfi->display, window->handle, x, y, width, height);
@ -308,8 +333,10 @@ void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int h
XFreePixmap(xfi->display, window->surface);
window->surface = surface;
window->x = x;
window->y = y;
window->left = x;
window->top = y;
window->right = x + width - 1;
window->bottom = y + height - 1;
window->width = width;
window->height = height;
}

View File

@ -31,8 +31,10 @@ typedef struct xf_window xfWindow;
struct xf_window
{
GC gc;
int x;
int y;
int left;
int top;
int right;
int bottom;
int width;
int height;
Window handle;

View File

@ -205,7 +205,7 @@ boolean xf_pre_connect(freerdp* instance)
if (settings->workarea)
{
settings->monitors[n].x = screen_info[n].x_org;
settings->monitors[n].y = screen_info[n].y_org;
settings->monitors[n].y = xfi->workArea.y;
settings->monitors[n].width = screen_info[n].width;
settings->monitors[n].height = xfi->workArea.height;
}

View File

@ -82,6 +82,27 @@ static void rail_WindowCachedIcon(rdpUpdate* update, WINDOW_ORDER_INFO* orderInf
printf("rail_WindowCachedIcon\n");
}
static void rail_NotifyIconCreate(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state)
{
rdpRail* rail;
rail = (rdpRail*) update->rail;
printf("NotifyIconCreate\n");
}
static void rail_NotifyIconUpdate(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state)
{
rdpRail* rail;
rail = (rdpRail*) update->rail;
printf("NotifyIconUpdate\n");
}
static void rail_NotifyIconDelete(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo)
{
rdpRail* rail;
rail = (rdpRail*) update->rail;
printf("NotifyIconDelete\n");
}
void rail_register_update_callbacks(rdpRail* rail, rdpUpdate* update)
{
update->WindowCreate = rail_WindowCreate;
@ -89,6 +110,9 @@ void rail_register_update_callbacks(rdpRail* rail, rdpUpdate* update)
update->WindowDelete = rail_WindowDelete;
update->WindowIcon = rail_WindowIcon;
update->WindowCachedIcon = rail_WindowCachedIcon;
update->NotifyIconCreate = rail_NotifyIconCreate;
update->NotifyIconUpdate = rail_NotifyIconUpdate;
update->NotifyIconDelete = rail_NotifyIconDelete;
}
rdpRail* rail_new(rdpSettings* settings)