Support for seamless window restacking (ZCHANGE).

git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/branches/seamlessrdp-branch/rdesktop@1150 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
Pierre Ossman 2006-03-17 08:52:29 +00:00
parent 905e228417
commit 8d65411c21
3 changed files with 108 additions and 1 deletions

View File

@ -278,6 +278,7 @@ void ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned
void ui_seamless_destroy_window(unsigned long id, unsigned long flags); void ui_seamless_destroy_window(unsigned long id, unsigned long flags);
void ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, void ui_seamless_move_window(unsigned long id, int x, int y, int width, int height,
unsigned long flags); unsigned long flags);
void ui_seamless_restack_window(unsigned long id, unsigned long behind, unsigned long flags);
void ui_seamless_settitle(unsigned long id, const char *title, unsigned long flags); void ui_seamless_settitle(unsigned long id, const char *title, unsigned long flags);
void ui_seamless_setstate(unsigned long id, unsigned int state, unsigned long flags); void ui_seamless_setstate(unsigned long id, unsigned int state, unsigned long flags);
void ui_seamless_syncbegin(unsigned long flags); void ui_seamless_syncbegin(unsigned long flags);
@ -287,6 +288,7 @@ BOOL lspci_init(void);
BOOL seamless_init(void); BOOL seamless_init(void);
void seamless_send_sync(void); void seamless_send_sync(void);
void seamless_send_state(unsigned long id, unsigned int state, unsigned long flags); void seamless_send_state(unsigned long id, unsigned int state, unsigned long flags);
void seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags);
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -151,7 +151,21 @@ seamless_process_line(const char *line, void *data)
} }
else if (!strcmp("ZCHANGE", tok1)) else if (!strcmp("ZCHANGE", tok1))
{ {
unimpl("SeamlessRDP ZCHANGE1\n"); unsigned long behind;
id = strtoul(tok2, &endptr, 0);
if (*endptr)
return False;
behind = strtoul(tok3, &endptr, 0);
if (*endptr)
return False;
flags = strtoul(tok4, &endptr, 0);
if (*endptr)
return False;
ui_seamless_restack_window(id, behind, flags);
} }
else if (!strcmp("TITLE", tok1)) else if (!strcmp("TITLE", tok1))
{ {
@ -323,3 +337,13 @@ seamless_send_state(unsigned long id, unsigned int state, unsigned long flags)
seamless_send("STATE,0x%08lx,0x%x,0x%lx\n", id, state, flags); seamless_send("STATE,0x%08lx,0x%x,0x%lx\n", id, state, flags);
} }
void
seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags)
{
if (!g_seamless_rdp)
return;
seamless_send("ZCHANGE,0x%08lx,0x%08lx,0x%lx\n", id, below, flags);
}

81
xwin.c
View File

@ -1744,6 +1744,42 @@ handle_button_event(XEvent xevent, BOOL down)
} }
} }
static void
ui_seamless_handle_restack(seamless_window * sw)
{
Status status;
Window root, parent, *children;
unsigned int nchildren, i;
seamless_window *sw_below;
status = XQueryTree(g_display, RootWindowOfScreen(g_screen),
&root, &parent, &children, &nchildren);
if (!status || !nchildren)
return;
sw_below = NULL;
i = 0;
while (children[i] != sw->wnd)
{
i++;
if (i >= nchildren)
return;
}
for (i++; i < nchildren; i++)
{
sw_below = seamless_get_window_by_wnd(children[i]);
if (sw_below)
break;
}
if (sw_below)
seamless_send_zchange(sw->id, sw_below->id, 0);
else
seamless_send_zchange(sw->id, 0, 0);
}
/* Process events in Xlib queue /* Process events in Xlib queue
Returns 0 after user quit, 1 otherwise */ Returns 0 after user quit, 1 otherwise */
static int static int
@ -1995,6 +2031,13 @@ xwin_process_events(void)
if (!g_seamless_active) if (!g_seamless_active)
rdp_send_client_window_status(0); rdp_send_client_window_status(0);
break; break;
case ConfigureNotify:
/* seamless */
sw = seamless_get_window_by_wnd(xevent.xconfigure.window);
if (!sw)
break;
ui_seamless_handle_restack(sw);
} }
} }
/* Keep going */ /* Keep going */
@ -3198,6 +3241,44 @@ ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, u
XMoveResizeWindow(g_display, sw->wnd, sw->xoffset, sw->yoffset, sw->width, sw->height); XMoveResizeWindow(g_display, sw->wnd, sw->xoffset, sw->yoffset, sw->width, sw->height);
} }
void
ui_seamless_restack_window(unsigned long id, unsigned long behind, unsigned long flags)
{
seamless_window *sw;
if (!g_seamless_active)
return;
sw = seamless_get_window_by_id(id);
if (!sw)
{
warning("ui_seamless_restack_window: No information for window 0x%lx\n", id);
return;
}
if (behind)
{
seamless_window *sw_behind;
Window wnds[2];
sw_behind = seamless_get_window_by_id(behind);
if (!sw_behind)
{
warning("ui_seamless_restack_window: No information for window 0x%lx\n",
behind);
return;
}
wnds[1] = sw_behind->wnd;
wnds[0] = sw->wnd;
XRestackWindows(g_display, wnds, 2);
}
else
{
XRaiseWindow(g_display, sw->wnd);
}
}
void void
ui_seamless_settitle(unsigned long id, const char *title, unsigned long flags) ui_seamless_settitle(unsigned long id, const char *title, unsigned long flags)