/[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 262 by astrand, Mon Nov 18 15:37:20 2002 UTC revision 275 by astrand, Tue Nov 19 14:48:02 2002 UTC
# Line 47  static XIM IM; Line 47  static XIM IM;
47  static XIC IC;  static XIC IC;
48  static XModifierKeymap *mod_map;  static XModifierKeymap *mod_map;
49  static Cursor current_cursor;  static Cursor current_cursor;
50    static Atom protocol_atom, kill_atom;
51    
52  /* endianness */  /* endianness */
53  static BOOL host_be;  static BOOL host_be;
# Line 298  ui_init(void) Line 299  ui_init(void)
299          host_be = !(BOOL) (*(uint8 *) (&test));          host_be = !(BOOL) (*(uint8 *) (&test));
300          xserver_be = (ImageByteOrder(display) == MSBFirst);          xserver_be = (ImageByteOrder(display) == MSBFirst);
301    
302            if ((width == 0) || (height == 0))
303            {
304                    /* Fetch geometry from _NET_WORKAREA */
305                    uint32 xpos, ypos;
306    
307                    if (get_current_workarea(&xpos, &ypos, &width, &height) < 0)
308                    {
309                            error("Failed to get workarea.\n");
310                            error("Perhaps your window manager does not support EWMH?\n");
311                            error("Defaulting to geometry 800x600\n");
312                            width = 800;
313                            height = 600;
314                    }
315            }
316    
317          if (fullscreen)          if (fullscreen)
318          {          {
319                  width = WidthOfScreen(screen);                  width = WidthOfScreen(screen);
# Line 421  ui_create_window(void) Line 437  ui_create_window(void)
437          focused = False;          focused = False;
438          mouse_in_wnd = False;          mouse_in_wnd = False;
439    
440            /* handle the WM_DELETE_WINDOW protocol */
441            protocol_atom = XInternAtom(display, "WM_PROTOCOLS", True);
442            kill_atom = XInternAtom(display, "WM_DELETE_WINDOW", True);
443            XSetWMProtocols(display, wnd, &kill_atom, 1);
444    
445          return True;          return True;
446  }  }
447    
# Line 458  xwin_toggle_fullscreen(void) Line 479  xwin_toggle_fullscreen(void)
479          }          }
480  }  }
481    
482  /* Process all events in Xlib queue */  /* Process all events in Xlib queue
483  static void     Returns 0 after user quit, 1 otherwise */
484    static int
485  xwin_process_events(void)  xwin_process_events(void)
486  {  {
487          XEvent xevent;          XEvent xevent;
# Line 487  xwin_process_events(void) Line 509  xwin_process_events(void)
509    
510                  switch (xevent.type)                  switch (xevent.type)
511                  {                  {
512                            case ClientMessage:
513                                    /* the window manager told us to quit */
514                                    if ((xevent.xclient.message_type == protocol_atom)
515                                        && (xevent.xclient.data.l[0] == kill_atom))
516                                            /* Quit */
517                                            return 0;
518                                    break;
519    
520                          case KeyPress:                          case KeyPress:
521                                  if (IC != NULL)                                  if (IC != NULL)
522                                          /* Multi_key compatible version */                                          /* Multi_key compatible version */
# Line 630  xwin_process_events(void) Line 660  xwin_process_events(void)
660    
661                  }                  }
662          }          }
663            /* Keep going */
664            return 1;
665  }  }
666    
667  void  /* Returns 0 after user quit, 1 otherwise */
668    int
669  ui_select(int rdp_socket)  ui_select(int rdp_socket)
670  {  {
671          int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1;          int n = (rdp_socket > x_socket) ? rdp_socket + 1 : x_socket + 1;
# Line 643  ui_select(int rdp_socket) Line 676  ui_select(int rdp_socket)
676          while (True)          while (True)
677          {          {
678                  /* Process any events already waiting */                  /* Process any events already waiting */
679                  xwin_process_events();                  if (!xwin_process_events())
680                            /* User quit */
681                            return 0;
682    
683                  FD_ZERO(&rfds);                  FD_ZERO(&rfds);
684                  FD_SET(rdp_socket, &rfds);                  FD_SET(rdp_socket, &rfds);
# Line 659  ui_select(int rdp_socket) Line 694  ui_select(int rdp_socket)
694                  }                  }
695    
696                  if (FD_ISSET(rdp_socket, &rfds))                  if (FD_ISSET(rdp_socket, &rfds))
697                          return;                          return 1;
698          }          }
699  }  }
700    
# Line 1175  ui_draw_text(uint8 font, uint8 flags, in Line 1210  ui_draw_text(uint8 font, uint8 flags, in
1210                                  else                                  else
1211                                  {                                  {
1212                                          error("this shouldn't be happening\n");                                          error("this shouldn't be happening\n");
1213                                          break;                                          exit(1);
1214                                  }                                  }
1215                                  /* this will move pointer from start to first character after FF command */                                  /* this will move pointer from start to first character after FF command */
1216                                  length -= i + 3;                                  length -= i + 3;

Legend:
Removed from v.262  
changed lines
  Added in v.275

  ViewVC Help
Powered by ViewVC 1.1.26