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

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

revision 116 by astrand, Wed Sep 11 11:11:27 2002 UTC revision 119 by astrand, Thu Sep 12 09:38:31 2002 UTC
# Line 247  close_inputmethod(void) Line 247  close_inputmethod(void)
247          }          }
248  }  }
249    
250  static BOOL  BOOL
251  get_key_state(int keysym)  get_key_state(int keysym)
252  {  {
253          int keysymMask = 0, modifierpos, key;          int keysymMask = 0, modifierpos, key;
# Line 517  toggle_fullscreen() Line 517  toggle_fullscreen()
517          XFreePixmap(display, pixmap);          XFreePixmap(display, pixmap);
518  }  }
519    
520    /* Process all events in Xlib queue */
521  static void  static void
522  xwin_process_events()  xwin_process_events()
523  {  {
# Line 530  xwin_process_events() Line 531  xwin_process_events()
531          char str[256];          char str[256];
532          Status status;          Status status;
533    
         /* Refresh keyboard mapping if it has changed. This is important for  
            Xvnc, since it allocates keycodes dynamically */  
         if (XCheckTypedEvent(display, MappingNotify, &xevent))  
         {  
                 if (xevent.xmapping.request == MappingKeyboard  
                     || xevent.xmapping.request == MappingModifier)  
                         XRefreshKeyboardMapping(&xevent.xmapping);  
         }  
   
534          while (XCheckMaskEvent(display, ~0, &xevent))          while (XCheckMaskEvent(display, ~0, &xevent))
535          {          {
536                  if (enable_compose && (XFilterEvent(&xevent, None) == True))                  if (enable_compose && (XFilterEvent(&xevent, None) == True))
# Line 574  xwin_process_events() Line 566  xwin_process_events()
566                                                        str, sizeof(str), &keysym, NULL);                                                        str, sizeof(str), &keysym, NULL);
567                                  }                                  }
568    
                                 if (keysym == XK_Break) /* toggle full screen */  
                                 {  
                                         if (get_key_state(XK_Alt_L) || get_key_state(XK_Alt_R))  
                                         {  
                                                 toggle_fullscreen();  
                                                 break;  
                                         }  
                                 }  
   
569                                  ksname = get_ksname(keysym);                                  ksname = get_ksname(keysym);
570                                  DEBUG_KBD(("\nKeyPress for (keysym 0x%lx, %s)\n", keysym, ksname));                                  DEBUG_KBD(("\nKeyPress for (keysym 0x%lx, %s)\n", keysym, ksname));
571    
572                                    if (handle_special_keys(keysym, ev_time, True))
573                                            break;
574    
575                                  tr = xkeymap_translate_key(keysym,                                  tr = xkeymap_translate_key(keysym,
576                                                             xevent.xkey.keycode, xevent.xkey.state);                                                             xevent.xkey.keycode, xevent.xkey.state);
577    
# Line 604  xwin_process_events() Line 590  xwin_process_events()
590                                  DEBUG_KBD(("\nKeyRelease for (keysym 0x%lx, %s)\n", keysym,                                  DEBUG_KBD(("\nKeyRelease for (keysym 0x%lx, %s)\n", keysym,
591                                             ksname));                                             ksname));
592    
593                                    if (handle_special_keys(keysym, ev_time, False))
594                                            break;
595    
596                                  tr = xkeymap_translate_key(keysym,                                  tr = xkeymap_translate_key(keysym,
597                                                             xevent.xkey.keycode, xevent.xkey.state);                                                             xevent.xkey.keycode, xevent.xkey.state);
598    
# Line 654  xwin_process_events() Line 643  xwin_process_events()
643                                            xevent.xexpose.height,                                            xevent.xexpose.height,
644                                            xevent.xexpose.x, xevent.xexpose.y);                                            xevent.xexpose.x, xevent.xexpose.y);
645                                  break;                                  break;
646    
647                            case MappingNotify:
648                                    /* Refresh keyboard mapping if it has changed. This is important for
649                                       Xvnc, since it allocates keycodes dynamically */
650                                    if (xevent.xmapping.request == MappingKeyboard
651                                        || xevent.xmapping.request == MappingModifier)
652                                            XRefreshKeyboardMapping(&xevent.xmapping);
653                                    break;
654    
655                  }                  }
656          }          }
657  }  }
# Line 663  ui_select(int rdp_socket) Line 661  ui_select(int rdp_socket)
661  {  {
662          int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1;          int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1;
663          fd_set rfds;          fd_set rfds;
664            XEvent xevent;
665    
666          FD_ZERO(&rfds);          FD_ZERO(&rfds);
667    
668          while (True)          while (True)
669          {          {
670                    /* Process any events already in queue */
671                    xwin_process_events();
672    
673                  FD_ZERO(&rfds);                  FD_ZERO(&rfds);
674                  FD_SET(rdp_socket, &rfds);                  FD_SET(rdp_socket, &rfds);
675                  if (display != NULL)                  if (display != NULL)
# Line 686  ui_select(int rdp_socket) Line 688  ui_select(int rdp_socket)
688                  }                  }
689    
690                  if (FD_ISSET(x_socket, &rfds))                  if (FD_ISSET(x_socket, &rfds))
691                          xwin_process_events();                  {
692                            /* Move new events from socket to queue */
693                            XPeekEvent(display, &xevent);
694                            continue;
695                    }
696    
697                  if (FD_ISSET(rdp_socket, &rfds))                  if (FD_ISSET(rdp_socket, &rfds))
698                          return;                          return;

Legend:
Removed from v.116  
changed lines
  Added in v.119

  ViewVC Help
Powered by ViewVC 1.1.26