rail: fixes for crash when creating and deleting windows fast and added support for xrdp rail / local decoration

This commit is contained in:
Jay Sorg 2012-09-18 15:57:19 -07:00
parent 52f7e679f8
commit 67b6acc7a8
3 changed files with 70 additions and 11 deletions

View File

@ -129,6 +129,11 @@ static boolean xf_event_MotionNotify(xfInfo* xfi, XEvent* event, boolean app)
if (app)
{
/* make sure window exists */
if (xf_rdpWindowFromWindow(xfi, event->xmotion.window) == 0)
{
return true;
}
// Translate to desktop coordinates
XTranslateCoordinates(xfi->display, event->xmotion.window,
RootWindowOfScreen(xfi->screen),
@ -227,8 +232,13 @@ static boolean xf_event_ButtonPress(xfInfo* xfi, XEvent* event, boolean app)
{
if (app)
{
/* make sure window exists */
if (xf_rdpWindowFromWindow(xfi, event->xbutton.window) == 0)
{
return true;
}
// Translate to desktop coordinates
XTranslateCoordinates(xfi->display, event->xmotion.window,
XTranslateCoordinates(xfi->display, event->xbutton.window,
RootWindowOfScreen(xfi->screen),
x, y, &x, &y, &childWindow);
}
@ -305,8 +315,13 @@ static boolean xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, boolean app)
{
if (app)
{
/* make sure window exists */
if (xf_rdpWindowFromWindow(xfi, event->xbutton.window) == NULL)
{
return true;
}
// Translate to desktop coordinates
XTranslateCoordinates(xfi->display, event->xmotion.window,
XTranslateCoordinates(xfi->display, event->xbutton.window,
RootWindowOfScreen(xfi->screen),
x, y, &x, &y, &childWindow);
}
@ -522,12 +537,28 @@ static boolean xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, boolean app)
(uint32) xfw->handle, xfw->left, xfw->top, xfw->right, xfw->bottom,
xfw->width, xfw->height, event->xconfigure.send_event);
//additonal checks for not in a local move and not ignoring configure to send position update to server,
//also should the window not be focused then do not send to server yet(ie. resizing using window decoration).
//The server will be updated when the window gets refocused.
if (app && (!event->xconfigure.send_event || xfi->window->local_move.state == LMS_NOT_ACTIVE)
&& !xfw->rail_ignore_configure && xfi->focused)
/* additonal checks for not in a local move and not ignoring configure to send
* position update to server, also should the window not be focused then do not
* send to server yet(ie. resizing using window decoration).
* The server will be updated when the window gets refocused. */
if (app && xfw->decorations)
{
/* moving resizing using window decoration */
xf_rail_adjust_position(xfi, window);
window->windowOffsetX = xfw->left;
window->visibleOffsetX = window->windowOffsetX;
window->windowOffsetY = xfw->top;
window->visibleOffsetY = window->windowOffsetY;
window->windowWidth = xfw->width;
window->windowHeight = xfw->height;
}
else
{
if (app && (!event->xconfigure.send_event || xfi->window->local_move.state == LMS_NOT_ACTIVE)
&& !xfw->rail_ignore_configure && xfi->focused)
xf_rail_adjust_position(xfi, window);
}
}
return True;
@ -642,9 +673,12 @@ static boolean xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, boolean app)
if (app == true)
{
rdpWindow* window;
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
window = window_list_get_by_extra_id(rail->list, (void*) event->xany.window);
window = xf_rdpWindowFromWindow(xfi, event->xproperty.window);
if (window == NULL)
{
return true;
}
if ((((Atom)event->xproperty.atom == xfi->_NET_WM_STATE) && (event->xproperty.state != PropertyDelete)) ||
(((Atom)event->xproperty.atom == xfi->WM_STATE) && (event->xproperty.state != PropertyDelete)))

View File

@ -482,7 +482,10 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
window->width = width;
window->height = height;
window->decorations = false;
/* this window need decorations
the WS_EX_APPWINDOW is used to tell the client to use local decorations
only sent from xrdp */
window->decorations = (wnd->extendedStyle & WS_EX_APPWINDOW) ? true : false;
window->fullscreen = false;
window->window = wnd;
window->local_move.state = LMS_NOT_ACTIVE;
@ -916,3 +919,24 @@ void xf_DestroyWindow(xfInfo* xfi, xfWindow* window)
xfree(window);
}
rdpWindow* xf_rdpWindowFromWindow(xfInfo* xfi, Window wnd)
{
rdpRail* rail;
if (xfi != NULL)
{
if (wnd != 0)
{
if (xfi->_context != NULL)
{
rail = xfi->_context->rail;
if (rail != NULL)
{
return window_list_get_by_extra_id(rail->list, (void*)(long)wnd);
}
}
}
}
return NULL;
}

View File

@ -104,6 +104,7 @@ void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, uint32 style, uint32 ex_st
void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height);
boolean xf_IsWindowBorder(xfInfo* xfi, xfWindow* xfw, int x, int y);
void xf_DestroyWindow(xfInfo* xfi, xfWindow* window);
rdpWindow* xf_rdpWindowFromWindow(xfInfo* xfi, Window wnd);
boolean xf_GetWindowProperty(xfInfo* xfi, Window window, Atom property, int length,
unsigned long* nitems, unsigned long* bytes, uint8** prop);