/[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 69 by astrand, Sat Jul 27 22:35:38 2002 UTC revision 80 by jsorg71, Tue Jul 30 00:56:48 2002 UTC
# Line 25  Line 25 
25  #define XK_MISCELLANY  #define XK_MISCELLANY
26  #include <X11/keysymdef.h>  #include <X11/keysymdef.h>
27  #include "rdesktop.h"  #include "rdesktop.h"
28    #include "scancodes.h"
29    
30  extern int width;  extern int width;
31  extern int height;  extern int height;
32  extern BOOL sendmotion;  extern BOOL sendmotion;
33  extern BOOL fullscreen;  extern BOOL fullscreen;
34    extern BOOL grab_keyboard;
35    
36  Display *display = NULL;  Display *display = NULL;
37  static int x_socket;  static int x_socket;
# Line 62  static uint32 *colmap; Line 64  static uint32 *colmap;
64  static XIM IM = NULL;  static XIM IM = NULL;
65  static XIC IC = NULL;  static XIC IC = NULL;
66    
67    /* Compose support */
68    BOOL enable_compose = False;
69    
70  #define TRANSLATE(col)          ( owncolmap ? col : translate_colour(colmap[col]) )  #define TRANSLATE(col)          ( owncolmap ? col : translate_colour(colmap[col]) )
71  #define SET_FOREGROUND(col)     XSetForeground(display, gc, TRANSLATE(col));  #define SET_FOREGROUND(col)     XSetForeground(display, gc, TRANSLATE(col));
72  #define SET_BACKGROUND(col)     XSetBackground(display, gc, TRANSLATE(col));  #define SET_BACKGROUND(col)     XSetBackground(display, gc, TRANSLATE(col));
# Line 185  translate_colour(uint32 colour) Line 190  translate_colour(uint32 colour)
190  static unsigned long  static unsigned long
191  init_inputmethod(void)  init_inputmethod(void)
192  {  {
193          unsigned long filtered_events;          unsigned long filtered_events = 0;
194    
195          IM = XOpenIM(display, NULL, NULL, NULL);          IM = XOpenIM(display, NULL, NULL, NULL);
196          if (IM == NULL)          if (IM == NULL)
# Line 248  ui_create_window(char *title) Line 253  ui_create_window(char *title)
253          Screen *screen;          Screen *screen;
254          uint16 test;          uint16 test;
255          int i;          int i;
         unsigned long filtered_events;  
256    
257          display = XOpenDisplay(NULL);          display = XOpenDisplay(NULL);
258    
# Line 345  ui_create_window(char *title) Line 349  ui_create_window(char *title)
349    
350          input_mask =          input_mask =
351                  KeyPressMask | KeyReleaseMask | ButtonPressMask |                  KeyPressMask | KeyReleaseMask | ButtonPressMask |
352                  ButtonReleaseMask | EnterWindowMask | LeaveWindowMask;                  ButtonReleaseMask;
353            if (grab_keyboard)
354                    input_mask |= EnterWindowMask | LeaveWindowMask;
355          if (sendmotion)          if (sendmotion)
356                  input_mask |= PointerMotionMask;                  input_mask |= PointerMotionMask;
357    
358          if (ownbackstore)          if (ownbackstore)
359                  input_mask |= ExposureMask;                  input_mask |= ExposureMask;
360    
361          filtered_events = init_inputmethod();          if (enable_compose)
362                    input_mask |= init_inputmethod();
363    
364          XSelectInput(display, wnd, input_mask | filtered_events);          XSelectInput(display, wnd, input_mask);
365    
366          gc = XCreateGC(display, wnd, 0, NULL);          gc = XCreateGC(display, wnd, 0, NULL);
367    
# Line 405  xwin_process_events() Line 412  xwin_process_events()
412    
413          while (XCheckMaskEvent(display, ~0, &xevent))          while (XCheckMaskEvent(display, ~0, &xevent))
414          {          {
415                  if (XFilterEvent(&xevent, None) == True)                  if (enable_compose && (XFilterEvent(&xevent, None) == True))
416                  {                  {
417                          DEBUG_KBD("Filtering event\n");                          DEBUG_KBD("Filtering event\n");
418                          continue;                          continue;
# Line 515  xwin_process_events() Line 522  xwin_process_events()
522                                                 xevent.xmotion.y);                                                 xevent.xmotion.y);
523                                  break;                                  break;
524    
525                            case FocusIn:
526                                    /* fall through */
527                          case EnterNotify:                          case EnterNotify:
528                                  XGrabKeyboard(display, wnd, True,                                  if (grab_keyboard)
529                                                GrabModeAsync, GrabModeAsync,                                          XGrabKeyboard(display, wnd, True,
530                                                CurrentTime);                                                        GrabModeAsync,
531                                                          GrabModeAsync,
532                                                          CurrentTime);
533                                  break;                                  break;
534    
535                            case FocusOut:
536                                    /* reset keys */
537                                    rdp_send_input(ev_time, RDP_INPUT_SCANCODE,
538                                                   KBD_FLAG_DOWN | KBD_FLAG_UP,
539                                                   SCANCODE_CHAR_LCTRL, 0);
540                                    rdp_send_input(ev_time, RDP_INPUT_SCANCODE,
541                                                   KBD_FLAG_DOWN | KBD_FLAG_UP,
542                                                   SCANCODE_CHAR_LALT, 0);
543                                    /* fall through */
544                          case LeaveNotify:                          case LeaveNotify:
545                                  XUngrabKeyboard(display, CurrentTime);                                  if (grab_keyboard)
546                                            XUngrabKeyboard(display, CurrentTime);
547                                  break;                                  break;
548    
549                          case Expose:                          case Expose:
# Line 586  ui_create_bitmap(int width, int height, Line 607  ui_create_bitmap(int width, int height,
607    
608          tdata = (owncolmap ? data : translate_image(width, height, data));          tdata = (owncolmap ? data : translate_image(width, height, data));
609          bitmap = XCreatePixmap(display, wnd, width, height, depth);          bitmap = XCreatePixmap(display, wnd, width, height, depth);
610          image = XCreateImage(display, visual, depth, ZPixmap, 0, tdata, width,          image = XCreateImage(display, visual, depth, ZPixmap, 0,
611                               height, 8, 0);                               (char *) tdata, width, height, 8, 0);
612    
613          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);
614    
# Line 605  ui_paint_bitmap(int x, int y, int cx, in Line 626  ui_paint_bitmap(int x, int y, int cx, in
626          uint8 *tdata;          uint8 *tdata;
627    
628          tdata = (owncolmap ? data : translate_image(width, height, data));          tdata = (owncolmap ? data : translate_image(width, height, data));
629          image = XCreateImage(display, visual, depth, ZPixmap, 0, tdata, width,          image = XCreateImage(display, visual, depth, ZPixmap, 0,
630                               height, 8, 0);                               (char *) tdata, width, height, 8, 0);
631    
632          if (ownbackstore)          if (ownbackstore)
633          {          {
# Line 642  ui_create_glyph(int width, int height, u Line 663  ui_create_glyph(int width, int height, u
663          bitmap = XCreatePixmap(display, wnd, width, height, 1);          bitmap = XCreatePixmap(display, wnd, width, height, 1);
664          gc = XCreateGC(display, bitmap, 0, NULL);          gc = XCreateGC(display, bitmap, 0, NULL);
665    
666          image = XCreateImage(display, visual, 1, ZPixmap, 0, data, width,          image = XCreateImage(display, visual, 1, ZPixmap, 0, (char *) data,
667                               height, 8, scanline);                               width, height, 8, scanline);
668          image->byte_order = MSBFirst;          image->byte_order = MSBFirst;
669          image->bitmap_bit_order = MSBFirst;          image->bitmap_bit_order = MSBFirst;
670          XInitImage(image);          XInitImage(image);
# Line 889  ui_patblt(uint8 opcode, Line 910  ui_patblt(uint8 opcode,
910                          FILL_RECTANGLE(x, y, cx, cy);                          FILL_RECTANGLE(x, y, cx, cy);
911    
912                          XSetFillStyle(display, gc, FillSolid);                          XSetFillStyle(display, gc, FillSolid);
913                            XSetTSOrigin(display, gc, 0, 0);
914                          ui_destroy_glyph((HGLYPH) fill);                          ui_destroy_glyph((HGLYPH) fill);
915                          break;                          break;
916    
# Line 1013  ui_draw_glyph(int mixmode, Line 1035  ui_draw_glyph(int mixmode,
1035        if ((xyoffset & 0x80))\        if ((xyoffset & 0x80))\
1036          {\          {\
1037            if (flags & TEXT2_VERTICAL) \            if (flags & TEXT2_VERTICAL) \
1038              y += ttext[++idx] | (ttext[++idx] << 8);\              y += ttext[idx+1] | (ttext[idx+2] << 8);\
1039            else\            else\
1040              x += ttext[++idx] | (ttext[++idx] << 8);\              x += ttext[idx+1] | (ttext[idx+2] << 8);\
1041              idx += 2;\
1042          }\          }\
1043        else\        else\
1044          {\          {\
# Line 1153  ui_desktop_restore(uint32 offset, int x, Line 1176  ui_desktop_restore(uint32 offset, int x,
1176          if (data == NULL)          if (data == NULL)
1177                  return;                  return;
1178    
1179          image = XCreateImage(display, visual, depth, ZPixmap, 0, data, cx, cy,          image = XCreateImage(display, visual, depth, ZPixmap, 0,
1180                               BitmapPad(display), cx * bpp / 8);                               (char *) data, cx, cy, BitmapPad(display),
1181                                 cx * bpp / 8);
1182    
1183          if (ownbackstore)          if (ownbackstore)
1184          {          {

Legend:
Removed from v.69  
changed lines
  Added in v.80

  ViewVC Help
Powered by ViewVC 1.1.26