CVS: rdesktop constants.h,1.45.2.2,1.45.2.3 proto.h,1.87.2.8,1.87.2.9 rdesktop.h,1.32.2.1,1.32.2.2 seamless.c,1.1.2.14,1.1.2.15 xwin.c,1.205.2.23,1.205.2.24
Peter Ã
strand <[email protected]> Fri, 17 Mar 2006 04:39:13 -0800
| Newsgroups | gmane.network.rdesktop.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28329
Modified Files:
Tag: seamlessrdp-branch
constants.h proto.h rdesktop.h seamless.c xwin.c
Log Message:
Send back our local positions upon changes, but only after a small timeout.
Index: constants.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/constants.h,v
retrieving revision 1.45.2.2
retrieving revision 1.45.2.3
diff -C2 -d -r1.45.2.2 -r1.45.2.3
*** constants.h 15 Mar 2006 12:58:50 -0000 1.45.2.2
--- constants.h 17 Mar 2006 12:39:09 -0000 1.45.2.3
***************
*** 419,420 ****
--- 419,421 ----
#define SEAMLESSRDP_MINIMIZED 1
#define SEAMLESSRDP_MAXIMIZED 2
+ #define SEAMLESSRDP_POSITION_TIMER 200000
Index: proto.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/proto.h,v
retrieving revision 1.87.2.8
retrieving revision 1.87.2.9
diff -C2 -d -r1.87.2.8 -r1.87.2.9
*** proto.h 17 Mar 2006 09:56:20 -0000 1.87.2.8
--- proto.h 17 Mar 2006 12:39:09 -0000 1.87.2.9
***************
*** 289,292 ****
--- 289,295 ----
void seamless_send_sync(void);
void seamless_send_state(unsigned long id, unsigned int state, unsigned long flags);
+ void seamless_send_position(unsigned long id, int x, int y, int width, int height,
+ unsigned long flags);
+ void seamless_select_timeout(struct timeval *tv);
void seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags);
void seamless_send_focus(unsigned long id, unsigned long flags);
Index: rdesktop.h
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/rdesktop.h,v
retrieving revision 1.32.2.1
retrieving revision 1.32.2.2
diff -C2 -d -r1.32.2.1 -r1.32.2.2
*** rdesktop.h 10 Mar 2006 10:40:50 -0000 1.32.2.1
--- rdesktop.h 17 Mar 2006 12:39:09 -0000 1.32.2.2
***************
*** 68,71 ****
--- 68,87 ----
#endif
+ /* timeval macros */
+ #ifndef timerisset
+ #define timerisset(tvp)\
+ ((tvp)->tv_sec || (tvp)->tv_usec)
+ #endif
+ #ifndef timercmp
+ #define timercmp(tvp, uvp, cmp)\
+ ((tvp)->tv_sec cmp (uvp)->tv_sec ||\
+ (tvp)->tv_sec == (uvp)->tv_sec &&\
+ (tvp)->tv_usec cmp (uvp)->tv_usec)
+ #endif
+ #ifndef timerclear
+ #define timerclear(tvp)\
+ ((tvp)->tv_sec = (tvp)->tv_usec = 0)
+ #endif
+
/* If configure does not define the endianess, try
to find it out */
Index: seamless.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/Attic/seamless.c,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -C2 -d -r1.1.2.14 -r1.1.2.15
*** seamless.c 17 Mar 2006 09:56:20 -0000 1.1.2.14
--- seamless.c 17 Mar 2006 12:39:09 -0000 1.1.2.15
***************
*** 341,344 ****
--- 341,368 ----
void
+ seamless_send_position(unsigned long id, int x, int y, int width, int height, unsigned long flags)
+ {
+ seamless_send("POSITION,0x%08lx,%d,%d,%d,%d,0x%lx\n", id, x, y, width, height, flags);
+ }
+
+
+ /* Update select timeout */
+ void
+ seamless_select_timeout(struct timeval *tv)
+ {
+ struct timeval ourtimeout = { 0, SEAMLESSRDP_POSITION_TIMER };
+
+ if (g_seamless_rdp)
+ {
+ if (timercmp(&ourtimeout, tv, <))
+ {
+ tv->tv_sec = ourtimeout.tv_sec;
+ tv->tv_usec = ourtimeout.tv_usec;
+ }
+ }
+ }
+
+
+ void
seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags)
{
Index: xwin.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/xwin.c,v
retrieving revision 1.205.2.23
retrieving revision 1.205.2.24
diff -C2 -d -r1.205.2.23 -r1.205.2.24
*** xwin.c 17 Mar 2006 10:48:11 -0000 1.205.2.23
--- xwin.c 17 Mar 2006 12:39:09 -0000 1.205.2.24
***************
*** 61,64 ****
--- 61,65 ----
int state; /* normal/minimized/maximized. */
unsigned int desktop;
+ struct timeval *position_timer;
struct _seamless_window *next;
} seamless_window;
***************
*** 326,329 ****
--- 327,369 ----
+ /* Send our position */
+ static void
+ seamless_update_position(seamless_window * sw)
+ {
+ XWindowAttributes wa;
+ int x, y;
+ Window child_return;
+
+ XGetWindowAttributes(g_display, sw->wnd, &wa);
+ XTranslateCoordinates(g_display, sw->wnd, wa.root,
+ -wa.border_width, -wa.border_width, &x, &y, &child_return);
+
+ seamless_send_position(sw->id, x, y, wa.width, wa.height, 0);
+ sw->xoffset = x;
+ sw->yoffset = y;
+ sw->width = wa.width;
+ sw->height = wa.height;
+ }
+
+
+ /* Check if it's time to send our position */
+ static void
+ seamless_check_timers()
+ {
+ seamless_window *sw;
+ struct timeval now;
+
+ gettimeofday(&now, NULL);
+ for (sw = g_seamless_windows; sw; sw = sw->next)
+ {
+ if (timerisset(sw->position_timer) && timercmp(sw->position_timer, &now, <))
+ {
+ timerclear(sw->position_timer);
+ seamless_update_position(sw);
+ }
+ }
+ }
+
+
static void
seamless_restack_window(seamless_window * sw, unsigned long behind)
***************
*** 2086,2095 ****
break;
case ConfigureNotify:
! /* seamless */
sw = seamless_get_window_by_wnd(xevent.xconfigure.window);
if (!sw)
! break;
ui_seamless_handle_restack(sw);
}
}
--- 2126,2154 ----
break;
case ConfigureNotify:
! if (!g_seamless_active)
! break;
!
sw = seamless_get_window_by_wnd(xevent.xconfigure.window);
if (!sw)
! {
! error("ConfigureNotify for unknown window 0x%lx\n",
! xevent.xconfigure.window);
! }
!
! gettimeofday(sw->position_timer, NULL);
! if (sw->position_timer->tv_usec + SEAMLESSRDP_POSITION_TIMER >=
! 1000000)
! {
! sw->position_timer->tv_usec +=
! SEAMLESSRDP_POSITION_TIMER - 1000000;
! sw->position_timer->tv_sec += 1;
! }
! else
! {
! sw->position_timer->tv_usec += SEAMLESSRDP_POSITION_TIMER;
! }
ui_seamless_handle_restack(sw);
+ break;
}
}
***************
*** 2115,2118 ****
--- 2174,2180 ----
return 0;
+ if (g_seamless_active)
+ seamless_check_timers();
+
FD_ZERO(&rfds);
FD_ZERO(&wfds);
***************
*** 2134,2137 ****
--- 2196,2200 ----
/* add redirection handles */
rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout);
+ seamless_select_timeout(&tv);
n++;
***************
*** 3217,3221 ****
XSetWMProtocols(g_display, wnd, &g_kill_atom, 1);
! sw = malloc(sizeof(seamless_window));
sw->wnd = wnd;
sw->id = id;
--- 3280,3284 ----
XSetWMProtocols(g_display, wnd, &g_kill_atom, 1);
! sw = xmalloc(sizeof(seamless_window));
sw->wnd = wnd;
sw->id = id;
***************
*** 3228,3231 ****
--- 3291,3296 ----
sw->state = SEAMLESSRDP_NOTYETMAPPED;
sw->desktop = 0;
+ sw->position_timer = xmalloc(sizeof(struct timeval));
+ timerclear(sw->position_timer);
sw->next = g_seamless_windows;
g_seamless_windows = sw;
***************
*** 3272,3285 ****
return;
! /* About MAX and MIN: Windows allows moving a window outside
! the desktop. This happens, for example, when maximizing an
! application. In this case, the position is set to something
! like -4,-4,1288,1032. Many WMs does not allow windows
! outside the desktop, however. Therefore, clip the window
! ourselves. */
! sw->xoffset = MAX(0, x);
! sw->yoffset = MAX(0, y);
! sw->width = MIN(MIN(width, width + x), g_width - sw->xoffset);
! sw->height = MIN(MIN(height, height + y), g_height - sw->yoffset);
/* If we move the window in a maximized state, then KDE won't
--- 3337,3344 ----
return;
! sw->xoffset = x;
! sw->yoffset = y;
! sw->width = width;
! sw->height = height;
/* If we move the window in a maximized state, then KDE won't
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642