/[rdesktop]/sourceforge.net/branches/seamlessrdp-branch/rdesktop/xwin.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/branches/seamlessrdp-branch/rdesktop/xwin.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1154 by ossman_, Fri Mar 17 09:56:20 2006 UTC revision 1171 by astrand, Mon Mar 20 15:55:18 2006 UTC
# Line 54  typedef struct _seamless_window Line 54  typedef struct _seamless_window
54  {  {
55          Window wnd;          Window wnd;
56          unsigned long id;          unsigned long id;
57          unsigned long parent;          unsigned long behind;
58          int xoffset, yoffset;          int xoffset, yoffset;
59          int width, height;          int width, height;
60          int state;              /* normal/minimized/maximized. */          int state;              /* normal/minimized/maximized. */
61          unsigned int desktop;          unsigned int desktop;
62            struct timeval *position_timer;
63    
64            BOOL outstanding_position;
65            unsigned int outpos_serial;
66            int outpos_xoffset, outpos_yoffset;
67            int outpos_width, outpos_height;
68    
69          struct _seamless_window *next;          struct _seamless_window *next;
70  } seamless_window;  } seamless_window;
71  static seamless_window *g_seamless_windows = NULL;  static seamless_window *g_seamless_windows = NULL;
72    static unsigned long g_seamless_focused = 0;
73  static BOOL g_seamless_started = False; /* Server end is up and running */  static BOOL g_seamless_started = False; /* Server end is up and running */
74  static BOOL g_seamless_active = False;  /* We are currently in seamless mode */  static BOOL g_seamless_active = False;  /* We are currently in seamless mode */
75  extern BOOL g_seamless_rdp;  extern BOOL g_seamless_rdp;
# Line 262  static int rop2_map[] = { Line 270  static int rop2_map[] = {
270  #define RESET_FUNCTION(rop2)    { if (rop2 != ROP2_COPY) XSetFunction(g_display, g_gc, GXcopy); }  #define RESET_FUNCTION(rop2)    { if (rop2 != ROP2_COPY) XSetFunction(g_display, g_gc, GXcopy); }
271    
272  static seamless_window *  static seamless_window *
273  seamless_get_window_by_id(unsigned long id)  sw_get_window_by_id(unsigned long id)
274  {  {
275          seamless_window *sw;          seamless_window *sw;
276          for (sw = g_seamless_windows; sw; sw = sw->next)          for (sw = g_seamless_windows; sw; sw = sw->next)
# Line 275  seamless_get_window_by_id(unsigned long Line 283  seamless_get_window_by_id(unsigned long
283    
284    
285  static seamless_window *  static seamless_window *
286  seamless_get_window_by_wnd(Window wnd)  sw_get_window_by_wnd(Window wnd)
287  {  {
288          seamless_window *sw;          seamless_window *sw;
289          for (sw = g_seamless_windows; sw; sw = sw->next)          for (sw = g_seamless_windows; sw; sw = sw->next)
# Line 288  seamless_get_window_by_wnd(Window wnd) Line 296  seamless_get_window_by_wnd(Window wnd)
296    
297    
298  static void  static void
299  seamless_remove_window(seamless_window * win)  sw_remove_window(seamless_window * win)
300  {  {
301          seamless_window *sw, **prevnext = &g_seamless_windows;          seamless_window *sw, **prevnext = &g_seamless_windows;
302          for (sw = g_seamless_windows; sw; sw = sw->next)          for (sw = g_seamless_windows; sw; sw = sw->next)
# Line 307  seamless_remove_window(seamless_window * Line 315  seamless_remove_window(seamless_window *
315    
316  /* Move all windows except wnd to new desktop */  /* Move all windows except wnd to new desktop */
317  static void  static void
318  seamless_all_to_desktop(Window wnd, unsigned int desktop)  sw_all_to_desktop(Window wnd, unsigned int desktop)
319  {  {
320          seamless_window *sw;          seamless_window *sw;
321          for (sw = g_seamless_windows; sw; sw = sw->next)          for (sw = g_seamless_windows; sw; sw = sw->next)
# Line 323  seamless_all_to_desktop(Window wnd, unsi Line 331  seamless_all_to_desktop(Window wnd, unsi
331  }  }
332    
333    
334    /* Send our position */
335    static void
336    sw_update_position(seamless_window * sw)
337    {
338            XWindowAttributes wa;
339            int x, y;
340            Window child_return;
341            unsigned int serial;
342    
343            XGetWindowAttributes(g_display, sw->wnd, &wa);
344            XTranslateCoordinates(g_display, sw->wnd, wa.root,
345                                  -wa.border_width, -wa.border_width, &x, &y, &child_return);
346    
347            serial = seamless_send_position(sw->id, x, y, wa.width, wa.height, 0);
348    
349            sw->outstanding_position = True;
350            sw->outpos_serial = serial;
351    
352            sw->outpos_xoffset = x;
353            sw->outpos_yoffset = y;
354            sw->outpos_width = wa.width;
355            sw->outpos_height = wa.height;
356    }
357    
358    
359    /* Check if it's time to send our position */
360    static void
361    sw_check_timers()
362    {
363            seamless_window *sw;
364            struct timeval now;
365    
366            gettimeofday(&now, NULL);
367            for (sw = g_seamless_windows; sw; sw = sw->next)
368            {
369                    if (timerisset(sw->position_timer) && timercmp(sw->position_timer, &now, <))
370                    {
371                            timerclear(sw->position_timer);
372                            sw_update_position(sw);
373                    }
374            }
375    }
376    
377    
378    static void
379    sw_restack_window(seamless_window * sw, unsigned long behind)
380    {
381            seamless_window *sw_above;
382    
383            /* Remove window from stack */
384            for (sw_above = g_seamless_windows; sw_above; sw_above = sw_above->next)
385            {
386                    if (sw_above->behind == sw->id)
387                            break;
388            }
389    
390            if (sw_above)
391                    sw_above->behind = sw->behind;
392    
393            /* And then add it at the new position */
394    
395            for (sw_above = g_seamless_windows; sw_above; sw_above = sw_above->next)
396            {
397                    if (sw_above->behind == behind)
398                            break;
399            }
400    
401            if (sw_above)
402                    sw_above->behind = sw->id;
403    
404            sw->behind = behind;
405    }
406    
407    
408    static void
409    sw_handle_restack(seamless_window * sw)
410    {
411            Status status;
412            Window root, parent, *children;
413            unsigned int nchildren, i;
414            seamless_window *sw_below;
415    
416            status = XQueryTree(g_display, RootWindowOfScreen(g_screen),
417                                &root, &parent, &children, &nchildren);
418            if (!status || !nchildren)
419                    return;
420    
421            sw_below = NULL;
422    
423            i = 0;
424            while (children[i] != sw->wnd)
425            {
426                    i++;
427                    if (i >= nchildren)
428                            return;
429            }
430    
431            for (i++; i < nchildren; i++)
432            {
433                    sw_below = sw_get_window_by_wnd(children[i]);
434                    if (sw_below)
435                            break;
436            }
437    
438            if (!sw_below && !sw->behind)
439                    return;
440            if (sw_below && (sw_below->id == sw->behind))
441                    return;
442    
443            if (sw_below)
444            {
445                    seamless_send_zchange(sw->id, sw_below->id, 0);
446                    sw_restack_window(sw, sw_below->id);
447            }
448            else
449            {
450                    seamless_send_zchange(sw->id, 0, 0);
451                    sw_restack_window(sw, 0);
452            }
453    }
454    
455    
456  static void  static void
457  mwm_hide_decorations(Window wnd)  mwm_hide_decorations(Window wnd)
458  {  {
# Line 1744  handle_button_event(XEvent xevent, BOOL Line 1874  handle_button_event(XEvent xevent, BOOL
1874          }          }
1875  }  }
1876    
 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);  
 }  
1877    
1878  /* Process events in Xlib queue  /* Process events in Xlib queue
1879     Returns 0 after user quit, 1 otherwise */     Returns 0 after user quit, 1 otherwise */
# Line 1913  xwin_process_events(void) Line 2008  xwin_process_events(void)
2008                                          XGrabKeyboard(g_display, g_wnd, True,                                          XGrabKeyboard(g_display, g_wnd, True,
2009                                                        GrabModeAsync, GrabModeAsync, CurrentTime);                                                        GrabModeAsync, GrabModeAsync, CurrentTime);
2010    
2011                                  sw = seamless_get_window_by_wnd(xevent.xfocus.window);                                  sw = sw_get_window_by_wnd(xevent.xfocus.window);
2012                                  if (!sw)                                  if (!sw)
2013                                          break;                                          break;
2014    
2015                                  seamless_send_focus(sw->id, 0);                                  if (sw->id != g_seamless_focused)
2016                                    {
2017                                            seamless_send_focus(sw->id, 0);
2018                                            g_seamless_focused = sw->id;
2019                                    }
2020                                  break;                                  break;
2021    
2022                          case FocusOut:                          case FocusOut:
# Line 1960  xwin_process_events(void) Line 2059  xwin_process_events(void)
2059                                  }                                  }
2060                                  else                                  else
2061                                  {                                  {
2062                                          sw = seamless_get_window_by_wnd(xevent.xexpose.window);                                          sw = sw_get_window_by_wnd(xevent.xexpose.window);
2063                                          if (sw)                                          if (sw)
2064                                                  XCopyArea(g_display, g_backstore,                                                  XCopyArea(g_display, g_backstore,
2065                                                            xevent.xexpose.window, g_gc,                                                            xevent.xexpose.window, g_gc,
# Line 2010  xwin_process_events(void) Line 2109  xwin_process_events(void)
2109                                          break;                                          break;
2110    
2111                                  /* seamless */                                  /* seamless */
2112                                  sw = seamless_get_window_by_wnd(xevent.xproperty.window);                                  sw = sw_get_window_by_wnd(xevent.xproperty.window);
2113                                  if (!sw)                                  if (!sw)
2114                                          break;                                          break;
2115    
# Line 2025  xwin_process_events(void) Line 2124  xwin_process_events(void)
2124                                      && (xevent.xproperty.state == PropertyNewValue))                                      && (xevent.xproperty.state == PropertyNewValue))
2125                                  {                                  {
2126                                          sw->desktop = ewmh_get_window_desktop(sw->wnd);                                          sw->desktop = ewmh_get_window_desktop(sw->wnd);
2127                                          seamless_all_to_desktop(sw->wnd, sw->desktop);                                          sw_all_to_desktop(sw->wnd, sw->desktop);
2128                                  }                                  }
2129    
2130                                  break;                                  break;
# Line 2038  xwin_process_events(void) Line 2137  xwin_process_events(void)
2137                                          rdp_send_client_window_status(0);                                          rdp_send_client_window_status(0);
2138                                  break;                                  break;
2139                          case ConfigureNotify:                          case ConfigureNotify:
2140                                  /* seamless */                                  if (!g_seamless_active)
                                 sw = seamless_get_window_by_wnd(xevent.xconfigure.window);  
                                 if (!sw)  
2141                                          break;                                          break;
2142    
2143                                  ui_seamless_handle_restack(sw);                                  sw = sw_get_window_by_wnd(xevent.xconfigure.window);
2144                                    if (!sw)
2145                                    {
2146                                            error("ConfigureNotify for unknown window 0x%lx\n",
2147                                                  xevent.xconfigure.window);
2148                                    }
2149    
2150                                    gettimeofday(sw->position_timer, NULL);
2151                                    if (sw->position_timer->tv_usec + SEAMLESSRDP_POSITION_TIMER >=
2152                                        1000000)
2153                                    {
2154                                            sw->position_timer->tv_usec +=
2155                                                    SEAMLESSRDP_POSITION_TIMER - 1000000;
2156                                            sw->position_timer->tv_sec += 1;
2157                                    }
2158                                    else
2159                                    {
2160                                            sw->position_timer->tv_usec += SEAMLESSRDP_POSITION_TIMER;
2161                                    }
2162    
2163                                    sw_handle_restack(sw);
2164                                    break;
2165                  }                  }
2166          }          }
2167          /* Keep going */          /* Keep going */
# Line 2067  ui_select(int rdp_socket) Line 2185  ui_select(int rdp_socket)
2185                          /* User quit */                          /* User quit */
2186                          return 0;                          return 0;
2187    
2188                    if (g_seamless_active)
2189                            sw_check_timers();
2190    
2191                  FD_ZERO(&rfds);                  FD_ZERO(&rfds);
2192                  FD_ZERO(&wfds);                  FD_ZERO(&wfds);
2193                  FD_SET(rdp_socket, &rfds);                  FD_SET(rdp_socket, &rfds);
# Line 2086  ui_select(int rdp_socket) Line 2207  ui_select(int rdp_socket)
2207    
2208                  /* add redirection handles */                  /* add redirection handles */
2209                  rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout);                  rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout);
2210                    seamless_select_timeout(&tv);
2211    
2212                  n++;                  n++;
2213    
# Line 3054  ui_end_update(void) Line 3176  ui_end_update(void)
3176  {  {
3177  }  }
3178    
3179    
3180  void  void
3181  ui_seamless_begin()  ui_seamless_begin()
3182  {  {
# Line 3064  ui_seamless_begin() Line 3187  ui_seamless_begin()
3187                  return;                  return;
3188    
3189          g_seamless_started = True;          g_seamless_started = True;
   
3190          ui_seamless_toggle();          ui_seamless_toggle();
3191  }  }
3192    
3193    
3194  void  void
3195  ui_seamless_toggle()  ui_seamless_toggle()
3196  {  {
# Line 3083  ui_seamless_toggle() Line 3206  ui_seamless_toggle()
3206                  while (g_seamless_windows)                  while (g_seamless_windows)
3207                  {                  {
3208                          XDestroyWindow(g_display, g_seamless_windows->wnd);                          XDestroyWindow(g_display, g_seamless_windows->wnd);
3209                          seamless_remove_window(g_seamless_windows);                          sw_remove_window(g_seamless_windows);
3210                  }                  }
3211                  XMapWindow(g_display, g_wnd);                  XMapWindow(g_display, g_wnd);
3212          }          }
# Line 3097  ui_seamless_toggle() Line 3220  ui_seamless_toggle()
3220          g_seamless_active = !g_seamless_active;          g_seamless_active = !g_seamless_active;
3221  }  }
3222    
3223    
3224  void  void
3225  ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long flags)  ui_seamless_create_window(unsigned long id, unsigned long parent, unsigned long flags)
3226  {  {
# Line 3111  ui_seamless_create_window(unsigned long Line 3235  ui_seamless_create_window(unsigned long
3235                  return;                  return;
3236    
3237          /* Ignore CREATEs for existing windows */          /* Ignore CREATEs for existing windows */
3238          sw = seamless_get_window_by_id(id);          sw = sw_get_window_by_id(id);
3239          if (sw)          if (sw)
3240                  return;                  return;
3241    
3242          get_window_attribs(&attribs);          get_window_attribs(&attribs);
         attribs.override_redirect = False;  
   
3243          wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), -1, -1, 1, 1, 0, g_depth,          wnd = XCreateWindow(g_display, RootWindowOfScreen(g_screen), -1, -1, 1, 1, 0, g_depth,
3244                              InputOutput, g_visual,                              InputOutput, g_visual,
3245                              CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |                              CWBackPixel | CWBackingStore | CWColormap | CWBorderPixel, &attribs);
                             CWBorderPixel, &attribs);  
3246    
3247          XStoreName(g_display, wnd, "SeamlessRDP");          XStoreName(g_display, wnd, "SeamlessRDP");
3248          ewmh_set_wm_name(wnd, "SeamlessRDP");          ewmh_set_wm_name(wnd, "SeamlessRDP");
# Line 3146  ui_seamless_create_window(unsigned long Line 3267  ui_seamless_create_window(unsigned long
3267                  XFree(sizehints);                  XFree(sizehints);
3268          }          }
3269    
3270            /* Handle popups without parents through some ewm hints */
3271            if (parent == 0xFFFFFFFF)
3272                    ewmh_set_window_popup(wnd);
3273          /* Set WM_TRANSIENT_FOR, if necessary */          /* Set WM_TRANSIENT_FOR, if necessary */
3274          if ((parent != 0x00000000) && (parent != 0xFFFFFFFF))          else if (parent != 0x00000000)
3275          {          {
3276                  sw_parent = seamless_get_window_by_id(parent);                  sw_parent = sw_get_window_by_id(parent);
3277                  if (sw_parent)                  if (sw_parent)
3278                          XSetTransientForHint(g_display, wnd, sw_parent->wnd);                          XSetTransientForHint(g_display, wnd, sw_parent->wnd);
3279                  else                  else
# Line 3169  ui_seamless_create_window(unsigned long Line 3293  ui_seamless_create_window(unsigned long
3293             serverside, instead of terminating rdesktop */             serverside, instead of terminating rdesktop */
3294          XSetWMProtocols(g_display, wnd, &g_kill_atom, 1);          XSetWMProtocols(g_display, wnd, &g_kill_atom, 1);
3295    
3296          sw = malloc(sizeof(seamless_window));          sw = xmalloc(sizeof(seamless_window));
3297          sw->wnd = wnd;          sw->wnd = wnd;
3298          sw->id = id;          sw->id = id;
3299          sw->parent = parent;          sw->behind = 0;
3300          sw->xoffset = 0;          sw->xoffset = 0;
3301          sw->yoffset = 0;          sw->yoffset = 0;
3302          sw->width = 0;          sw->width = 0;
3303          sw->height = 0;          sw->height = 0;
3304          sw->state = SEAMLESSRDP_NOTYETMAPPED;          sw->state = SEAMLESSRDP_NOTYETMAPPED;
3305          sw->desktop = 0;          sw->desktop = 0;
3306            sw->position_timer = xmalloc(sizeof(struct timeval));
3307            timerclear(sw->position_timer);
3308            sw->outstanding_position = False;
3309          sw->next = g_seamless_windows;          sw->next = g_seamless_windows;
3310          g_seamless_windows = sw;          g_seamless_windows = sw;
3311  }  }
# Line 3192  ui_seamless_destroy_window(unsigned long Line 3319  ui_seamless_destroy_window(unsigned long
3319          if (!g_seamless_active)          if (!g_seamless_active)
3320                  return;                  return;
3321    
3322          sw = seamless_get_window_by_id(id);          sw = sw_get_window_by_id(id);
3323          if (!sw)          if (!sw)
3324          {          {
3325                  warning("ui_seamless_destroy_window: No information for window 0x%lx\n", id);                  warning("ui_seamless_destroy_window: No information for window 0x%lx\n", id);
# Line 3200  ui_seamless_destroy_window(unsigned long Line 3327  ui_seamless_destroy_window(unsigned long
3327          }          }
3328    
3329          XDestroyWindow(g_display, sw->wnd);          XDestroyWindow(g_display, sw->wnd);
3330          seamless_remove_window(sw);          sw_remove_window(sw);
3331  }  }
3332    
3333    
# Line 3212  ui_seamless_move_window(unsigned long id Line 3339  ui_seamless_move_window(unsigned long id
3339          if (!g_seamless_active)          if (!g_seamless_active)
3340                  return;                  return;
3341    
3342          sw = seamless_get_window_by_id(id);          sw = sw_get_window_by_id(id);
3343          if (!sw)          if (!sw)
3344          {          {
3345                  warning("ui_seamless_move_window: No information for window 0x%lx\n", id);                  warning("ui_seamless_move_window: No information for window 0x%lx\n", id);
3346                  return;                  return;
3347          }          }
3348    
3349            /* We ignore server updates until it has handled our request. */
3350            if (sw->outstanding_position)
3351                    return;
3352    
3353          if (!width || !height)          if (!width || !height)
3354                  /* X11 windows must be at least 1x1 */                  /* X11 windows must be at least 1x1 */
3355                  return;                  return;
3356    
3357          /* About MAX and MIN: Windows allows moving a window outside          sw->xoffset = x;
3358             the desktop. This happens, for example, when maximizing an          sw->yoffset = y;
3359             application. In this case, the position is set to something          sw->width = width;
3360             like -4,-4,1288,1032. Many WMs does not allow windows          sw->height = height;
            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);  
3361    
3362          /* If we move the window in a maximized state, then KDE won't          /* If we move the window in a maximized state, then KDE won't
3363             accept restoration */             accept restoration */
# Line 3247  ui_seamless_move_window(unsigned long id Line 3372  ui_seamless_move_window(unsigned long id
3372          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);
3373  }  }
3374    
3375    
3376  void  void
3377  ui_seamless_restack_window(unsigned long id, unsigned long behind, unsigned long flags)  ui_seamless_restack_window(unsigned long id, unsigned long behind, unsigned long flags)
3378  {  {
# Line 3255  ui_seamless_restack_window(unsigned long Line 3381  ui_seamless_restack_window(unsigned long
3381          if (!g_seamless_active)          if (!g_seamless_active)
3382                  return;                  return;
3383    
3384          sw = seamless_get_window_by_id(id);          sw = sw_get_window_by_id(id);
3385          if (!sw)          if (!sw)
3386          {          {
3387                  warning("ui_seamless_restack_window: No information for window 0x%lx\n", id);                  warning("ui_seamless_restack_window: No information for window 0x%lx\n", id);
# Line 3267  ui_seamless_restack_window(unsigned long Line 3393  ui_seamless_restack_window(unsigned long
3393                  seamless_window *sw_behind;                  seamless_window *sw_behind;
3394                  Window wnds[2];                  Window wnds[2];
3395    
3396                  sw_behind = seamless_get_window_by_id(behind);                  sw_behind = sw_get_window_by_id(behind);
3397                  if (!sw_behind)                  if (!sw_behind)
3398                  {                  {
3399                          warning("ui_seamless_restack_window: No information for window 0x%lx\n",                          warning("ui_seamless_restack_window: No information for window 0x%lx\n",
# Line 3284  ui_seamless_restack_window(unsigned long Line 3410  ui_seamless_restack_window(unsigned long
3410          {          {
3411                  XRaiseWindow(g_display, sw->wnd);                  XRaiseWindow(g_display, sw->wnd);
3412          }          }
3413    
3414            sw_restack_window(sw, behind);
3415  }  }
3416    
3417    
3418  void  void
3419  ui_seamless_settitle(unsigned long id, const char *title, unsigned long flags)  ui_seamless_settitle(unsigned long id, const char *title, unsigned long flags)
3420  {  {
# Line 3294  ui_seamless_settitle(unsigned long id, c Line 3423  ui_seamless_settitle(unsigned long id, c
3423          if (!g_seamless_active)          if (!g_seamless_active)
3424                  return;                  return;
3425    
3426          sw = seamless_get_window_by_id(id);          sw = sw_get_window_by_id(id);
3427          if (!sw)          if (!sw)
3428          {          {
3429                  warning("ui_seamless_settitle: No information for window 0x%lx\n", id);                  warning("ui_seamless_settitle: No information for window 0x%lx\n", id);
# Line 3315  ui_seamless_setstate(unsigned long id, u Line 3444  ui_seamless_setstate(unsigned long id, u
3444          if (!g_seamless_active)          if (!g_seamless_active)
3445                  return;                  return;
3446    
3447          sw = seamless_get_window_by_id(id);          sw = sw_get_window_by_id(id);
3448          if (!sw)          if (!sw)
3449          {          {
3450                  warning("ui_seamless_setstate: No information for window 0x%lx\n", id);                  warning("ui_seamless_setstate: No information for window 0x%lx\n", id);
# Line 3353  ui_seamless_setstate(unsigned long id, u Line 3482  ui_seamless_setstate(unsigned long id, u
3482                          break;                          break;
3483          }          }
3484    
         /* Handle popups without parents through some ewm hints */  
         if ((sw->state == SEAMLESSRDP_NOTYETMAPPED) && (sw->parent == 0xFFFFFFFF))  
                 ewmh_set_window_popup(sw->wnd);  
   
3485          sw->state = state;          sw->state = state;
3486  }  }
3487    
# Line 3371  ui_seamless_syncbegin(unsigned long flag Line 3496  ui_seamless_syncbegin(unsigned long flag
3496          while (g_seamless_windows)          while (g_seamless_windows)
3497          {          {
3498                  XDestroyWindow(g_display, g_seamless_windows->wnd);                  XDestroyWindow(g_display, g_seamless_windows->wnd);
3499                  seamless_remove_window(g_seamless_windows);                  sw_remove_window(g_seamless_windows);
3500          }          }
3501  }  }
3502    
3503    
3504    void
3505    ui_seamless_ack(unsigned int serial)
3506    {
3507            seamless_window *sw;
3508            for (sw = g_seamless_windows; sw; sw = sw->next)
3509            {
3510                    if (sw->outpos_serial == serial)
3511                    {
3512                            sw->xoffset = sw->outpos_xoffset;
3513                            sw->yoffset = sw->outpos_yoffset;
3514                            sw->width = sw->outpos_width;
3515                            sw->height = sw->outpos_height;
3516                            sw->outstanding_position = False;
3517                            break;
3518                    }
3519            }
3520    
3521            return;
3522    }

Legend:
Removed from v.1154  
changed lines
  Added in v.1171

  ViewVC Help
Powered by ViewVC 1.1.26