/[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 1403 by stargo, Thu Apr 12 16:04:25 2007 UTC revision 1407 by astrand, Mon May 14 12:11:15 2007 UTC
# Line 102  static int g_bpp; Line 102  static int g_bpp;
102  static XIM g_IM;  static XIM g_IM;
103  static XIC g_IC;  static XIC g_IC;
104  static XModifierKeymap *g_mod_map;  static XModifierKeymap *g_mod_map;
105    /* Maps logical (xmodmap -pp) pointing device buttons (0-based) back
106       to physical (1-based) indices. */
107    static unsigned char g_pointer_log_to_phys_map[16];
108  static Cursor g_current_cursor;  static Cursor g_current_cursor;
109  static RD_HCURSOR g_null_cursor = NULL;  static RD_HCURSOR g_null_cursor = NULL;
110  static Atom g_protocol_atom, g_kill_atom;  static Atom g_protocol_atom, g_kill_atom;
# Line 1260  translate_image(int width, int height, u Line 1263  translate_image(int width, int height, u
1263          return out;          return out;
1264  }  }
1265    
1266    static void
1267    xwin_refresh_pointer_map(void)
1268    {
1269            unsigned char phys_to_log_map[sizeof(g_pointer_log_to_phys_map)];
1270            int i, pointer_buttons;
1271    
1272            pointer_buttons = XGetPointerMapping(g_display, phys_to_log_map, sizeof(phys_to_log_map));
1273            for (i = 0; i < pointer_buttons; ++i)
1274            {
1275                    /* This might produce multiple logical buttons mapping
1276                       to a single physical one, but hey, that's
1277                       life... */
1278                    g_pointer_log_to_phys_map[phys_to_log_map[i] - 1] = i + 1;
1279            }
1280    }
1281    
1282  RD_BOOL  RD_BOOL
1283  get_key_state(unsigned int state, uint32 keysym)  get_key_state(unsigned int state, uint32 keysym)
1284  {  {
# Line 1614  ui_init(void) Line 1633  ui_init(void)
1633          g_width = (g_width + 3) & ~3;          g_width = (g_width + 3) & ~3;
1634    
1635          g_mod_map = XGetModifierMapping(g_display);          g_mod_map = XGetModifierMapping(g_display);
1636            xwin_refresh_pointer_map();
1637    
1638          xkeymap_init();          xkeymap_init();
1639    
# Line 1877  handle_button_event(XEvent xevent, RD_BO Line 1897  handle_button_event(XEvent xevent, RD_BO
1897  {  {
1898          uint16 button, flags = 0;          uint16 button, flags = 0;
1899          g_last_gesturetime = xevent.xbutton.time;          g_last_gesturetime = xevent.xbutton.time;
1900            /* Reverse the pointer button mapping, e.g. in the case of
1901               "left-handed mouse mode"; the RDP session expects to
1902               receive physical buttons (true in mstsc as well) and
1903               logical button behavior depends on the remote desktop's own
1904               mouse settings */
1905            xevent.xbutton.button = g_pointer_log_to_phys_map[xevent.xbutton.button - 1];
1906          button = xkeymap_translate_button(xevent.xbutton.button);          button = xkeymap_translate_button(xevent.xbutton.button);
1907          if (button == 0)          if (button == 0)
1908                  return;                  return;
# Line 2164  xwin_process_events(void) Line 2190  xwin_process_events(void)
2190                                          XFreeModifiermap(g_mod_map);                                          XFreeModifiermap(g_mod_map);
2191                                          g_mod_map = XGetModifierMapping(g_display);                                          g_mod_map = XGetModifierMapping(g_display);
2192                                  }                                  }
2193    
2194                                    if (xevent.xmapping.request == MappingPointer)
2195                                    {
2196                                            xwin_refresh_pointer_map();
2197                                    }
2198    
2199                                  break;                                  break;
2200    
2201                                  /* clipboard stuff */                                  /* clipboard stuff */

Legend:
Removed from v.1403  
changed lines
  Added in v.1407

  ViewVC Help
Powered by ViewVC 1.1.26