/[rdesktop]/jpeg/rdesktop/trunk/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 /jpeg/rdesktop/trunk/xwin.c

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

revision 1453 by astrand, Fri Mar 14 07:39:38 2008 UTC revision 1485 by astrand, Tue Nov 25 08:05:25 2008 UTC
# Line 1  Line 1 
1  /* -*- c-basic-offset: 8 -*-  /* -*- c-basic-offset: 8 -*-
2     rdesktop: A Remote Desktop Protocol client.     rdesktop: A Remote Desktop Protocol client.
3     User interface services - X Window System     User interface services - X Window System
4     Copyright (C) Matthew Chapman 1999-2007     Copyright (C) Matthew Chapman 1999-2008
5     Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB     Copyright 2007-2008 Pierre Ossman <ossman@cendio.se> for Cendio AB
6    
7     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 86  static unsigned long g_seamless_focused Line 86  static unsigned long g_seamless_focused
86  static RD_BOOL g_seamless_started = False;      /* Server end is up and running */  static RD_BOOL g_seamless_started = False;      /* Server end is up and running */
87  static RD_BOOL g_seamless_active = False;       /* We are currently in seamless mode */  static RD_BOOL g_seamless_active = False;       /* We are currently in seamless mode */
88  static RD_BOOL g_seamless_hidden = False;       /* Desktop is hidden on server */  static RD_BOOL g_seamless_hidden = False;       /* Desktop is hidden on server */
89    static RD_BOOL g_seamless_broken_restack = False;       /* WM does not properly restack */
90  extern RD_BOOL g_seamless_rdp;  extern RD_BOOL g_seamless_rdp;
91    
92  extern uint32 g_embed_wnd;  extern uint32 g_embed_wnd;
# Line 109  static XIC g_IC; Line 110  static XIC g_IC;
110  static XModifierKeymap *g_mod_map;  static XModifierKeymap *g_mod_map;
111  /* Maps logical (xmodmap -pp) pointing device buttons (0-based) back  /* Maps logical (xmodmap -pp) pointing device buttons (0-based) back
112     to physical (1-based) indices. */     to physical (1-based) indices. */
113  static unsigned char g_pointer_log_to_phys_map[16];  static unsigned char g_pointer_log_to_phys_map[32];
114  static Cursor g_current_cursor;  static Cursor g_current_cursor;
115  static RD_HCURSOR g_null_cursor = NULL;  static RD_HCURSOR g_null_cursor = NULL;
116  static Atom g_protocol_atom, g_kill_atom;  static Atom g_protocol_atom, g_kill_atom;
# Line 529  mwm_hide_decorations(Window wnd) Line 530  mwm_hide_decorations(Window wnd)
530    
531  }  }
532    
533    typedef struct _sw_configurenotify_context
534    {
535            Window window;
536            unsigned long serial;
537    } sw_configurenotify_context;
538    
539    /* Predicate procedure for sw_wait_configurenotify */
540    static Bool
541    sw_configurenotify_p(Display * display, XEvent * xevent, XPointer arg)
542    {
543            sw_configurenotify_context *context = (sw_configurenotify_context *) arg;
544            if (xevent->xany.type == ConfigureNotify
545                && xevent->xconfigure.window == context->window
546                && xevent->xany.serial >= context->serial)
547                    return True;
548    
549            return False;
550    }
551    
552    /* Wait for a ConfigureNotify, with a equal or larger serial, on the
553       specified window. The event will be removed from the queue. We
554       could use XMaskEvent(StructureNotifyMask), but we would then risk
555       throwing away crucial events like DestroyNotify.
556    
557       After a ConfigureWindow, according to ICCCM section 4.1.5, we
558       should recieve a ConfigureNotify, either a real or synthetic
559       one. This indicates that the configure has been "completed".
560       However, some WMs such as several versions of Metacity fails to
561       send synthetic events. See bug
562       http://bugzilla.gnome.org/show_bug.cgi?id=322840. We need to use a
563       timeout to avoid a hang. Tk uses the same approach. */
564    static void
565    sw_wait_configurenotify(Window wnd, unsigned long serial)
566    {
567            XEvent xevent;
568            sw_configurenotify_context context;
569            struct timeval now;
570            struct timeval nextsecond;
571            RD_BOOL got = False;
572    
573            context.window = wnd;
574            context.serial = serial;
575    
576            gettimeofday(&nextsecond, NULL);
577            nextsecond.tv_sec += 1;
578    
579            do
580            {
581                    if (XCheckIfEvent(g_display, &xevent, sw_configurenotify_p, (XPointer) & context))
582                    {
583                            got = True;
584                            break;
585                    }
586                    usleep(100000);
587                    gettimeofday(&now, NULL);
588            }
589            while (timercmp(&now, &nextsecond, <));
590    
591            if (!got)
592            {
593                    warning("Broken Window Manager: Timeout while waiting for ConfigureNotify\n");
594            }
595    }
596    
597    /* Get the toplevel window, in case of reparenting */
598    static Window
599    sw_get_toplevel(Window wnd)
600    {
601            Window root, parent;
602            Window *child_list;
603            unsigned int num_children;
604    
605            while (1)
606            {
607                    XQueryTree(g_display, wnd, &root, &parent, &child_list, &num_children);
608                    if (root == parent)
609                    {
610                            break;
611                    }
612                    else if (!parent)
613                    {
614                            warning("Internal error: sw_get_toplevel called with root window\n");
615                    }
616    
617                    wnd = parent;
618            }
619    
620            return wnd;
621    }
622    
623    
624    /* Check if wnd is already behind a window wrt stacking order */
625    static RD_BOOL
626    sw_window_is_behind(Window wnd, Window behind)
627    {
628            Window dummy1, dummy2;
629            Window *child_list;
630            unsigned int num_children;
631            unsigned int i;
632            RD_BOOL found_behind = False;
633            RD_BOOL found_wnd = False;
634    
635            wnd = sw_get_toplevel(wnd);
636            behind = sw_get_toplevel(behind);
637    
638            XQueryTree(g_display, RootWindowOfScreen(g_screen), &dummy1, &dummy2, &child_list,
639                       &num_children);
640    
641            for (i = num_children - 1; i >= 0; i--)
642            {
643                    if (child_list[i] == behind)
644                    {
645                            found_behind = True;
646                    }
647                    else if (child_list[i] == wnd)
648                    {
649                            found_wnd = True;
650                            break;
651                    }
652            }
653    
654            if (child_list)
655                    XFree(child_list);
656    
657            if (!found_wnd)
658            {
659                    warning("sw_window_is_behind: Unable to find window 0x%lx\n", wnd);
660    
661                    if (!found_behind)
662                    {
663                            warning("sw_window_is_behind: Unable to find behind window 0x%lx\n",
664                                    behind);
665                    }
666            }
667    
668            return found_behind;
669    }
670    
671    
672    /* Test if the window manager correctly handles window restacking. In
673       particular, we are testing if it's possible to place a window
674       between two other windows. Many WMs such as Metacity can only stack
675       windows on the top or bottom. The window creation should mostly
676       match ui_seamless_create_window. */
677    static void
678    seamless_restack_test()
679    {
680            /* The goal is to have the middle window between top and
681               bottom.  The middle window is initially at the top,
682               though. */
683            Window wnds[3];         /* top, middle and bottom */
684            int i;
685            XEvent xevent;
686            XWindowChanges values;
687            unsigned long restack_serial;
688    
689            for (i = 0; i < 3; i++)
690            {
691                    char name[64];
692                    wnds[i] =
693                            XCreateSimpleWindow(g_display, RootWindowOfScreen(g_screen), 0, 0, 20, 20,
694                                                0, 0, 0);
695                    snprintf(name, sizeof(name), "SeamlessRDP restack test - window %d", i);
696                    XStoreName(g_display, wnds[i], name);
697                    ewmh_set_wm_name(wnds[i], name);
698    
699                    /* Hide decorations. Often this means that no
700                       reparenting will be done, which makes the restack
701                       easier. Besides, we want to mimic our other
702                       seamless windows as much as possible. We must still
703                       handle the case with reparenting, though. */
704                    mwm_hide_decorations(wnds[i]);
705    
706                    /* Prevent windows from appearing in task bar */
707                    XSetTransientForHint(g_display, wnds[i], RootWindowOfScreen(g_screen));
708                    ewmh_set_window_popup(wnds[i]);
709    
710                    /* We need to catch MapNotify/ConfigureNotify */
711                    XSelectInput(g_display, wnds[i], StructureNotifyMask);
712            }
713    
714            /* Map Windows. Currently, we assume that XMapRaised places
715               the window on the top of the stack. Should be fairly safe;
716               the window is configured before it's mapped. */
717            XMapRaised(g_display, wnds[2]); /* bottom */
718            do
719            {
720                    XWindowEvent(g_display, wnds[2], StructureNotifyMask, &xevent);
721            }
722            while (xevent.type != MapNotify);
723            XMapRaised(g_display, wnds[0]); /* top */
724            do
725            {
726                    XWindowEvent(g_display, wnds[0], StructureNotifyMask, &xevent);
727            }
728            while (xevent.type != MapNotify);
729            XMapRaised(g_display, wnds[1]); /* middle */
730            do
731            {
732                    XWindowEvent(g_display, wnds[1], StructureNotifyMask, &xevent);
733            }
734            while (xevent.type != MapNotify);
735    
736            /* The stacking order should now be 1 - 0 - 2 */
737            if (!sw_window_is_behind(wnds[0], wnds[1]) || !sw_window_is_behind(wnds[2], wnds[1]))
738            {
739                    /* Ok, technically a WM is allowed to stack windows arbitrarily, but... */
740                    warning("Broken Window Manager: Unable to test window restacking\n");
741                    g_seamless_broken_restack = True;
742                    for (i = 0; i < 3; i++)
743                            XDestroyWindow(g_display, wnds[i]);
744                    return;
745            }
746    
747            /* Restack, using XReconfigureWMWindow, which should correctly
748               handle reparented windows as well as nonreparenting WMs. */
749            values.stack_mode = Below;
750            values.sibling = wnds[0];
751            restack_serial = XNextRequest(g_display);
752            XReconfigureWMWindow(g_display, wnds[1], DefaultScreen(g_display), CWStackMode | CWSibling,
753                                 &values);
754            sw_wait_configurenotify(wnds[1], restack_serial);
755    
756            /* Now verify that middle is behind top but not behind
757               bottom */
758            if (!sw_window_is_behind(wnds[1], wnds[0]))
759            {
760                    warning("Broken Window Manager: doesn't handle restack (restack request was ignored)\n");
761                    g_seamless_broken_restack = True;
762            }
763            else if (sw_window_is_behind(wnds[1], wnds[2]))
764            {
765                    warning("Broken Window Manager: doesn't handle restack (window was moved to bottom)\n");
766                    g_seamless_broken_restack = True;
767            }
768    
769            /* Destroy windows */
770            for (i = 0; i < 3; i++)
771                    XDestroyWindow(g_display, wnds[i]);
772    }
773    
774  #define SPLITCOLOUR15(colour, rv) \  #define SPLITCOLOUR15(colour, rv) \
775  { \  { \
776          rv.red = ((colour >> 7) & 0xf8) | ((colour >> 12) & 0x7); \          rv.red = ((colour >> 7) & 0xf8) | ((colour >> 12) & 0x7); \
# Line 1283  xwin_refresh_pointer_map(void) Line 1525  xwin_refresh_pointer_map(void)
1525          int i, pointer_buttons;          int i, pointer_buttons;
1526    
1527          pointer_buttons = XGetPointerMapping(g_display, phys_to_log_map, sizeof(phys_to_log_map));          pointer_buttons = XGetPointerMapping(g_display, phys_to_log_map, sizeof(phys_to_log_map));
1528          for (i = 0; i < pointer_buttons; ++i)          if (pointer_buttons > sizeof(phys_to_log_map))
1529          {                  pointer_buttons = sizeof(phys_to_log_map);
1530                  /* This might produce multiple logical buttons mapping  
1531                     to a single physical one, but hey, that's          /* if multiple physical buttons map to the same logical button, then
1532                     life... */           * use the lower numbered physical one */
1533            for (i = pointer_buttons - 1; i >= 0; i--)
1534            {
1535                    /* a user could specify arbitrary values for the logical button
1536                     * number, ignore any that are abnormally large */
1537                    if (phys_to_log_map[i] > sizeof(g_pointer_log_to_phys_map))
1538                            continue;
1539                  g_pointer_log_to_phys_map[phys_to_log_map[i] - 1] = i + 1;                  g_pointer_log_to_phys_map[phys_to_log_map[i] - 1] = i + 1;
1540          }          }
1541  }  }
# Line 1536  select_visual(int screen_num) Line 1784  select_visual(int screen_num)
1784  }  }
1785    
1786  static XErrorHandler g_old_error_handler;  static XErrorHandler g_old_error_handler;
1787    static RD_BOOL g_error_expected = False;
1788    
1789    /* Check if the X11 window corresponding to a seamless window with
1790       specified id exists. */
1791    RD_BOOL
1792    sw_window_exists(unsigned long id)
1793    {
1794            seamless_window *sw;
1795            char *name;
1796            Status sts = 0;
1797    
1798            sw = sw_get_window_by_id(id);
1799            if (!sw)
1800                    return False;
1801    
1802            g_error_expected = True;
1803            sts = XFetchName(g_display, sw->wnd, &name);
1804            g_error_expected = False;
1805            if (sts)
1806            {
1807                    XFree(name);
1808            }
1809    
1810            return sts;
1811    }
1812    
1813  static int  static int
1814  error_handler(Display * dpy, XErrorEvent * eev)  error_handler(Display * dpy, XErrorEvent * eev)
1815  {  {
1816          if ((eev->error_code == BadMatch) && (eev->request_code == X_ConfigureWindow))          if (g_error_expected)
         {  
                 fprintf(stderr, "Got \"BadMatch\" when trying to restack windows.\n");  
                 fprintf(stderr,  
                         "This is most likely caused by a broken window manager (commonly KWin).\n");  
1817                  return 0;                  return 0;
         }  
1818    
1819          return g_old_error_handler(dpy, eev);          return g_old_error_handler(dpy, eev);
1820  }  }
# Line 1656  ui_init(void) Line 1924  ui_init(void)
1924          xclip_init();          xclip_init();
1925          ewmh_init();          ewmh_init();
1926          if (g_seamless_rdp)          if (g_seamless_rdp)
1927            {
1928                  seamless_init();                  seamless_init();
1929            }
1930    
1931          DEBUG_RDP5(("server bpp %d client bpp %d depth %d\n", g_server_depth, g_bpp, g_depth));          DEBUG_RDP5(("server bpp %d client bpp %d depth %d\n", g_server_depth, g_bpp, g_depth));
1932    
# Line 1831  ui_create_window(void) Line 2101  ui_create_window(void)
2101          if (g_null_cursor == NULL)          if (g_null_cursor == NULL)
2102                  g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data);                  g_null_cursor = ui_create_cursor(0, 0, 1, 1, null_pointer_mask, null_pointer_data);
2103    
2104            if (g_seamless_rdp)
2105            {
2106                    seamless_restack_test();
2107            }
2108    
2109          return True;          return True;
2110  }  }
2111    
# Line 2138  xwin_process_events(void) Line 2413  xwin_process_events(void)
2413                                  if (!sw)                                  if (!sw)
2414                                          break;                                          break;
2415    
2416                                    /* Menu windows are real X11 windows,
2417                                       with focus. When such a window is
2418                                       destroyed, focus is reverted to the
2419                                       main application window, which
2420                                       would cause us to send FOCUS. This
2421                                       breaks window switching in, say,
2422                                       Seamonkey. We shouldn't need to
2423                                       send FOCUS: Windows should also
2424                                       revert focus to some other window
2425                                       when the menu window is
2426                                       destroyed. So, we only send FOCUS
2427                                       if the previous focus window still
2428                                       exists. */
2429                                  if (sw->id != g_seamless_focused)                                  if (sw->id != g_seamless_focused)
2430                                  {                                  {
2431                                          seamless_send_focus(sw->id, 0);  
2432                                            if (sw_window_exists(g_seamless_focused))
2433                                                    seamless_send_focus(sw->id, 0);
2434                                          g_seamless_focused = sw->id;                                          g_seamless_focused = sw->id;
2435                                  }                                  }
2436                                  break;                                  break;
# Line 2780  ui_patblt(uint8 opcode, Line 3070  ui_patblt(uint8 opcode,
3070                          break;                          break;
3071    
3072                  case 3: /* Pattern */                  case 3: /* Pattern */
3073                          for (i = 0; i != 8; i++)                          if (brush->bd == 0)     /* rdp4 brush */
3074                                  ipattern[7 - i] = brush->pattern[i];                          {
3075                          fill = (Pixmap) ui_create_glyph(8, 8, ipattern);                                  for (i = 0; i != 8; i++)
3076                          SET_FOREGROUND(bgcolour);                                          ipattern[7 - i] = brush->pattern[i];
3077                          SET_BACKGROUND(fgcolour);                                  fill = (Pixmap) ui_create_glyph(8, 8, ipattern);
3078                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);                                  SET_FOREGROUND(bgcolour);
3079                          XSetStipple(g_display, g_gc, fill);                                  SET_BACKGROUND(fgcolour);
3080                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);                                  XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
3081                          FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);                                  XSetStipple(g_display, g_gc, fill);
3082                          XSetFillStyle(g_display, g_gc, FillSolid);                                  XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
3083                          XSetTSOrigin(g_display, g_gc, 0, 0);                                  FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
3084                          ui_destroy_glyph((RD_HGLYPH) fill);                                  XSetFillStyle(g_display, g_gc, FillSolid);
3085                                    XSetTSOrigin(g_display, g_gc, 0, 0);
3086                                    ui_destroy_glyph((RD_HGLYPH) fill);
3087                            }
3088                            else if (brush->bd->colour_code > 1)    /* > 1 bpp */
3089                            {
3090                                    fill = (Pixmap) ui_create_bitmap(8, 8, brush->bd->data);
3091                                    XSetFillStyle(g_display, g_gc, FillTiled);
3092                                    XSetTile(g_display, g_gc, fill);
3093                                    XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
3094                                    FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
3095                                    XSetFillStyle(g_display, g_gc, FillSolid);
3096                                    XSetTSOrigin(g_display, g_gc, 0, 0);
3097                                    ui_destroy_bitmap((RD_HBITMAP) fill);
3098                            }
3099                            else
3100                            {
3101                                    fill = (Pixmap) ui_create_glyph(8, 8, brush->bd->data);
3102                                    SET_FOREGROUND(bgcolour);
3103                                    SET_BACKGROUND(fgcolour);
3104                                    XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
3105                                    XSetStipple(g_display, g_gc, fill);
3106                                    XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
3107                                    FILL_RECTANGLE_BACKSTORE(x, y, cx, cy);
3108                                    XSetFillStyle(g_display, g_gc, FillSolid);
3109                                    XSetTSOrigin(g_display, g_gc, 0, 0);
3110                                    ui_destroy_glyph((RD_HGLYPH) fill);
3111                            }
3112                          break;                          break;
3113    
3114                  default:                  default:
# Line 2954  ui_polygon(uint8 opcode, Line 3271  ui_polygon(uint8 opcode,
3271                          break;                          break;
3272    
3273                  case 3: /* Pattern */                  case 3: /* Pattern */
3274                          for (i = 0; i != 8; i++)                          if (brush->bd == 0)     /* rdp4 brush */
3275                                  ipattern[7 - i] = brush->pattern[i];                          {
3276                          fill = (Pixmap) ui_create_glyph(8, 8, ipattern);                                  for (i = 0; i != 8; i++)
3277                          SET_FOREGROUND(bgcolour);                                          ipattern[7 - i] = brush->pattern[i];
3278                          SET_BACKGROUND(fgcolour);                                  fill = (Pixmap) ui_create_glyph(8, 8, ipattern);
3279                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);                                  SET_FOREGROUND(bgcolour);
3280                          XSetStipple(g_display, g_gc, fill);                                  SET_BACKGROUND(fgcolour);
3281                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);                                  XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
3282                          FILL_POLYGON((XPoint *) point, npoints);                                  XSetStipple(g_display, g_gc, fill);
3283                          XSetFillStyle(g_display, g_gc, FillSolid);                                  XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
3284                          XSetTSOrigin(g_display, g_gc, 0, 0);                                  FILL_POLYGON((XPoint *) point, npoints);
3285                          ui_destroy_glyph((RD_HGLYPH) fill);                                  XSetFillStyle(g_display, g_gc, FillSolid);
3286                                    XSetTSOrigin(g_display, g_gc, 0, 0);
3287                                    ui_destroy_glyph((RD_HGLYPH) fill);
3288                            }
3289                            else if (brush->bd->colour_code > 1)    /* > 1 bpp */
3290                            {
3291                                    fill = (Pixmap) ui_create_bitmap(8, 8, brush->bd->data);
3292                                    XSetFillStyle(g_display, g_gc, FillTiled);
3293                                    XSetTile(g_display, g_gc, fill);
3294                                    XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
3295                                    FILL_POLYGON((XPoint *) point, npoints);
3296                                    XSetFillStyle(g_display, g_gc, FillSolid);
3297                                    XSetTSOrigin(g_display, g_gc, 0, 0);
3298                                    ui_destroy_bitmap((RD_HBITMAP) fill);
3299                            }
3300                            else
3301                            {
3302                                    fill = (Pixmap) ui_create_glyph(8, 8, brush->bd->data);
3303                                    SET_FOREGROUND(bgcolour);
3304                                    SET_BACKGROUND(fgcolour);
3305                                    XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
3306                                    XSetStipple(g_display, g_gc, fill);
3307                                    XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
3308                                    FILL_POLYGON((XPoint *) point, npoints);
3309                                    XSetFillStyle(g_display, g_gc, FillSolid);
3310                                    XSetTSOrigin(g_display, g_gc, 0, 0);
3311                                    ui_destroy_glyph((RD_HGLYPH) fill);
3312                            }
3313                          break;                          break;
3314    
3315                  default:                  default:
# Line 3032  ui_ellipse(uint8 opcode, Line 3376  ui_ellipse(uint8 opcode,
3376                          break;                          break;
3377    
3378                  case 3: /* Pattern */                  case 3: /* Pattern */
3379                          for (i = 0; i != 8; i++)                          if (brush->bd == 0)     /* rdp4 brush */
3380                                  ipattern[7 - i] = brush->pattern[i];                          {
3381                          fill = (Pixmap) ui_create_glyph(8, 8, ipattern);                                  for (i = 0; i != 8; i++)
3382                          SET_FOREGROUND(bgcolour);                                          ipattern[7 - i] = brush->pattern[i];
3383                          SET_BACKGROUND(fgcolour);                                  fill = (Pixmap) ui_create_glyph(8, 8, ipattern);
3384                          XSetFillStyle(g_display, g_gc, FillOpaqueStippled);                                  SET_FOREGROUND(bgcolour);
3385                          XSetStipple(g_display, g_gc, fill);                                  SET_BACKGROUND(fgcolour);
3386                          XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);                                  XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
3387                          DRAW_ELLIPSE(x, y, cx, cy, fillmode);                                  XSetStipple(g_display, g_gc, fill);
3388                          XSetFillStyle(g_display, g_gc, FillSolid);                                  XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
3389                          XSetTSOrigin(g_display, g_gc, 0, 0);                                  DRAW_ELLIPSE(x, y, cx, cy, fillmode);
3390                          ui_destroy_glyph((RD_HGLYPH) fill);                                  XSetFillStyle(g_display, g_gc, FillSolid);
3391                                    XSetTSOrigin(g_display, g_gc, 0, 0);
3392                                    ui_destroy_glyph((RD_HGLYPH) fill);
3393                            }
3394                            else if (brush->bd->colour_code > 1)    /* > 1 bpp */
3395                            {
3396                                    fill = (Pixmap) ui_create_bitmap(8, 8, brush->bd->data);
3397                                    XSetFillStyle(g_display, g_gc, FillTiled);
3398                                    XSetTile(g_display, g_gc, fill);
3399                                    XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
3400                                    DRAW_ELLIPSE(x, y, cx, cy, fillmode);
3401                                    XSetFillStyle(g_display, g_gc, FillSolid);
3402                                    XSetTSOrigin(g_display, g_gc, 0, 0);
3403                                    ui_destroy_bitmap((RD_HBITMAP) fill);
3404                            }
3405                            else
3406                            {
3407                                    fill = (Pixmap) ui_create_glyph(8, 8, brush->bd->data);
3408                                    SET_FOREGROUND(bgcolour);
3409                                    SET_BACKGROUND(fgcolour);
3410                                    XSetFillStyle(g_display, g_gc, FillOpaqueStippled);
3411                                    XSetStipple(g_display, g_gc, fill);
3412                                    XSetTSOrigin(g_display, g_gc, brush->xorigin, brush->yorigin);
3413                                    DRAW_ELLIPSE(x, y, cx, cy, fillmode);
3414                                    XSetFillStyle(g_display, g_gc, FillSolid);
3415                                    XSetTSOrigin(g_display, g_gc, 0, 0);
3416                                    ui_destroy_glyph((RD_HGLYPH) fill);
3417                            }
3418                          break;                          break;
3419    
3420                  default:                  default:
# Line 3683  void Line 4054  void
4054  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)
4055  {  {
4056          seamless_window *sw;          seamless_window *sw;
4057            XWindowChanges values;
4058            unsigned long restack_serial;
4059    
4060          if (!g_seamless_active)          if (!g_seamless_active)
4061                  return;                  return;
# Line 3697  ui_seamless_restack_window(unsigned long Line 4070  ui_seamless_restack_window(unsigned long
4070          if (behind)          if (behind)
4071          {          {
4072                  seamless_window *sw_behind;                  seamless_window *sw_behind;
                 Window wnds[2];  
4073    
4074                  sw_behind = sw_get_window_by_id(behind);                  sw_behind = sw_get_window_by_id(behind);
4075                  if (!sw_behind)                  if (!sw_behind)
# Line 3706  ui_seamless_restack_window(unsigned long Line 4078  ui_seamless_restack_window(unsigned long
4078                          return;                          return;
4079                  }                  }
4080    
4081                  wnds[1] = sw->wnd;                  if (!g_seamless_broken_restack)
4082                  wnds[0] = sw_behind->wnd;                  {
4083                            values.stack_mode = Below;
4084                  XRestackWindows(g_display, wnds, 2);                          values.sibling = sw_behind->wnd;
4085                            restack_serial = XNextRequest(g_display);
4086                            XReconfigureWMWindow(g_display, sw->wnd, DefaultScreen(g_display),
4087                                                 CWStackMode | CWSibling, &values);
4088                            sw_wait_configurenotify(sw->wnd, restack_serial);
4089                    }
4090          }          }
4091          else          else
4092          {          {
4093                  XRaiseWindow(g_display, sw->wnd);                  values.stack_mode = Above;
4094                    restack_serial = XNextRequest(g_display);
4095                    XReconfigureWMWindow(g_display, sw->wnd, DefaultScreen(g_display), CWStackMode,
4096                                         &values);
4097                    sw_wait_configurenotify(sw->wnd, restack_serial);
4098          }          }
4099    
4100          sw_restack_window(sw, behind);          sw_restack_window(sw, behind);

Legend:
Removed from v.1453  
changed lines
  Added in v.1485

  ViewVC Help
Powered by ViewVC 1.1.26