/[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 100 by jsorg71, Sat Aug 24 20:04:56 2002 UTC revision 102 by astrand, Mon Aug 26 17:14:04 2002 UTC
# Line 247  close_inputmethod(void) Line 247  close_inputmethod(void)
247          }          }
248  }  }
249    
250    static BOOL
251    get_key_state(int keysym)
252    {
253            int keysymMask = 0, modifierpos, key;
254            Window wDummy1, wDummy2;
255            int iDummy3, iDummy4, iDummy5, iDummy6;
256            unsigned int current_state;
257            int offset;
258    
259            XModifierKeymap *map = XGetModifierMapping(display);
260            KeyCode keycode = XKeysymToKeycode(display, keysym);
261    
262            if (keycode == NoSymbol)
263                    return False;
264    
265            for (modifierpos = 0; modifierpos < 8; modifierpos++)
266            {
267                    offset = map->max_keypermod * modifierpos;
268    
269                    for (key = 0; key < map->max_keypermod; key++)
270                    {
271                            if (map->modifiermap[offset + key] == keycode)
272                                    keysymMask = 1 << modifierpos;
273                    }
274            }
275    
276            XQueryPointer(display, DefaultRootWindow(display), &wDummy1,
277                          &wDummy2, &iDummy3, &iDummy4, &iDummy5, &iDummy6, &current_state);
278    
279            XFreeModifiermap(map);
280    
281            return (current_state & keysymMask) ? True : False;
282    }
283    
284    
285  BOOL  BOOL
286  ui_init()  ui_init()
287  {  {
# Line 266  ui_init() Line 301  ui_init()
301          return True;          return True;
302  }  }
303    
304  BOOL  void
305  ui_create_window_obj(int xpos, int ypos, int width, int height, int valuemask)  ui_create_window_obj(int xpos, int ypos, int width, int height, int valuemask)
306  {  {
307          XClassHint *classhints;          XClassHint *classhints;
# Line 277  ui_create_window_obj(int xpos, int ypos, Line 312  ui_create_window_obj(int xpos, int ypos,
312          screen = DefaultScreenOfDisplay(display);          screen = DefaultScreenOfDisplay(display);
313    
314          wnd = XCreateWindow(display, RootWindowOfScreen(screen), xpos,          wnd = XCreateWindow(display, RootWindowOfScreen(screen), xpos,
315                                  ypos, width, height, 0, CopyFromParent,                              ypos, width, height, 0, CopyFromParent,
316                                  InputOutput, CopyFromParent, valuemask, &attribs);                              InputOutput, CopyFromParent, valuemask, &attribs);
317    
318    
319          XStoreName(display, wnd, title);          XStoreName(display, wnd, title);
# Line 311  ui_create_window_obj(int xpos, int ypos, Line 346  ui_create_window_obj(int xpos, int ypos,
346          XMapWindow(display, wnd);          XMapWindow(display, wnd);
347    
348          /* Wait for VisibilityNotify Event */          /* Wait for VisibilityNotify Event */
349          for (;;) {          for (;;)
350            {
351                  XNextEvent(display, &xevent);                  XNextEvent(display, &xevent);
352                  if (xevent.type == VisibilityNotify)                  if (xevent.type == VisibilityNotify)
353                          break;                          break;
# Line 397  ui_create_window() Line 433  ui_create_window()
433    
434    
435          input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |          input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
436                          VisibilityChangeMask | FocusChangeMask;                  VisibilityChangeMask | FocusChangeMask;
437    
438          if (grab_keyboard)          if (grab_keyboard)
439                  input_mask |= EnterWindowMask | LeaveWindowMask;                  input_mask |= EnterWindowMask | LeaveWindowMask;
# Line 408  ui_create_window() Line 444  ui_create_window()
444                  input_mask |= ExposureMask;                  input_mask |= ExposureMask;
445    
446          if (fullscreen)          if (fullscreen)
447                  ui_create_window_obj(0, 0, width, height, CWBackingStore | CWBackPixel | CWOverrideRedirect);                  ui_create_window_obj(0, 0, width, height,
448                                         CWBackingStore | CWBackPixel | CWOverrideRedirect);
449          else          else
450                  ui_create_window_obj(0, 0, width, height, CWBackingStore | CWBackPixel);                  ui_create_window_obj(0, 0, width, height, CWBackingStore | CWBackPixel);
451    
# Line 462  toggle_fullscreen() Line 499  toggle_fullscreen()
499                  XFreePixmap(display, backstore);                  XFreePixmap(display, backstore);
500          XFreeGC(display, gc);          XFreeGC(display, gc);
501          XDestroyWindow(display, wnd);          XDestroyWindow(display, wnd);
502          if (fullscreen) {          if (fullscreen)
503            {
504                  attribs.override_redirect = True;                  attribs.override_redirect = True;
505                  ui_create_window_obj(0, 0, dpy_width, dpy_height,                  ui_create_window_obj(0, 0, dpy_width, dpy_height,
506                                                                          CWBackingStore | CWBackPixel | CWOverrideRedirect);                                       CWBackingStore | CWBackPixel | CWOverrideRedirect);
507          }          }
508          else {          else
509            {
510                  attribs.override_redirect = False;                  attribs.override_redirect = False;
511                  ui_create_window_obj(0, 0, width, height,                  ui_create_window_obj(0, 0, width, height, CWBackingStore | CWBackPixel);
                                                                         CWBackingStore | CWBackPixel);  
512          }          }
513          ui_set_cursor(cache_get_cursor(0));          ui_set_cursor(cache_get_cursor(0));
514          ui_move_pointer(width / 2, height / 2);          ui_move_pointer(width / 2, height / 2);
# Line 539  xwin_process_events() Line 577  xwin_process_events()
577                                                        str, sizeof(str), &keysym, NULL);                                                        str, sizeof(str), &keysym, NULL);
578                                  }                                  }
579    
580                                  /* FIXME needs alt modifier */                                  if (keysym == XK_Break) /* toggle full screen */
                                 if (keysym == XK_Break) /* toggle full screen */  
581                                  {                                  {
582                                          toggle_fullscreen();                                          if (get_key_state(XK_Alt_L) || get_key_state(XK_Alt_R))
583                                          break;                                          {
584                                                    toggle_fullscreen();
585                                                    break;
586                                            }
587                                  }                                  }
588    
589                                  ksname = get_ksname(keysym);                                  ksname = get_ksname(keysym);
590                                  DEBUG_KBD(("\nKeyPress for (keysym 0x%lx, %s)\n", keysym, ksname));                                  DEBUG_KBD(("\nKeyPress for (keysym 0x%lx, %s)\n", keysym, ksname));
591    

Legend:
Removed from v.100  
changed lines
  Added in v.102

  ViewVC Help
Powered by ViewVC 1.1.26