/[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 70 by astrand, Sat Jul 27 23:09:32 2002 UTC revision 81 by jsorg71, Tue Jul 30 01:57:39 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 239  close_inputmethod(void) Line 241  close_inputmethod(void)
241          }          }
242  }  }
243    
244    BOOL
245    ui_init()
246    {
247            Screen *screen;
248            display = XOpenDisplay(NULL);
249            if (display == NULL)
250            {
251                    error("Failed to open display\n");
252                    return False;
253            }
254            if(fullscreen)
255            {
256                    screen = DefaultScreenOfDisplay(display);
257                    width = WidthOfScreen(screen);
258                    height = HeightOfScreen(screen);
259            }
260            return True;
261    }
262    
263  BOOL  BOOL
264  ui_create_window(char *title)  ui_create_window(char *title)
# Line 252  ui_create_window(char *title) Line 272  ui_create_window(char *title)
272          uint16 test;          uint16 test;
273          int i;          int i;
274    
         display = XOpenDisplay(NULL);  
   
         if (display == NULL)  
         {  
                 error("Failed to open display\n");  
                 return False;  
         }  
   
275          x_socket = ConnectionNumber(display);          x_socket = ConnectionNumber(display);
276          screen = DefaultScreenOfDisplay(display);          screen = DefaultScreenOfDisplay(display);
277          visual = DefaultVisualOfScreen(screen);          visual = DefaultVisualOfScreen(screen);
# Line 347  ui_create_window(char *title) Line 359  ui_create_window(char *title)
359    
360          input_mask =          input_mask =
361                  KeyPressMask | KeyReleaseMask | ButtonPressMask |                  KeyPressMask | KeyReleaseMask | ButtonPressMask |
362                  ButtonReleaseMask | EnterWindowMask | LeaveWindowMask;                  ButtonReleaseMask;
363            if (grab_keyboard)
364                    input_mask |= EnterWindowMask | LeaveWindowMask;
365          if (sendmotion)          if (sendmotion)
366                  input_mask |= PointerMotionMask;                  input_mask |= PointerMotionMask;
367    
# Line 518  xwin_process_events() Line 532  xwin_process_events()
532                                                 xevent.xmotion.y);                                                 xevent.xmotion.y);
533                                  break;                                  break;
534    
535                            case FocusIn:
536                                    /* fall through */
537                          case EnterNotify:                          case EnterNotify:
538                                  XGrabKeyboard(display, wnd, True,                                  if (grab_keyboard)
539                                                GrabModeAsync, GrabModeAsync,                                          XGrabKeyboard(display, wnd, True,
540                                                CurrentTime);                                                        GrabModeAsync,
541                                                          GrabModeAsync,
542                                                          CurrentTime);
543                                  break;                                  break;
544    
545                            case FocusOut:
546                                    /* reset keys */
547                                    rdp_send_input(ev_time, RDP_INPUT_SCANCODE,
548                                                   KBD_FLAG_DOWN | KBD_FLAG_UP,
549                                                   SCANCODE_CHAR_LCTRL, 0);
550                                    rdp_send_input(ev_time, RDP_INPUT_SCANCODE,
551                                                   KBD_FLAG_DOWN | KBD_FLAG_UP,
552                                                   SCANCODE_CHAR_LALT, 0);
553                                    /* fall through */
554                          case LeaveNotify:                          case LeaveNotify:
555                                  XUngrabKeyboard(display, CurrentTime);                                  if (grab_keyboard)
556                                            XUngrabKeyboard(display, CurrentTime);
557                                  break;                                  break;
558    
559                          case Expose:                          case Expose:
# Line 589  ui_create_bitmap(int width, int height, Line 617  ui_create_bitmap(int width, int height,
617    
618          tdata = (owncolmap ? data : translate_image(width, height, data));          tdata = (owncolmap ? data : translate_image(width, height, data));
619          bitmap = XCreatePixmap(display, wnd, width, height, depth);          bitmap = XCreatePixmap(display, wnd, width, height, depth);
620          image = XCreateImage(display, visual, depth, ZPixmap, 0, tdata, width,          image = XCreateImage(display, visual, depth, ZPixmap, 0,
621                               height, 8, 0);                               (char *) tdata, width, height, 8, 0);
622    
623          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);          XPutImage(display, bitmap, gc, image, 0, 0, 0, 0, width, height);
624    
# Line 608  ui_paint_bitmap(int x, int y, int cx, in Line 636  ui_paint_bitmap(int x, int y, int cx, in
636          uint8 *tdata;          uint8 *tdata;
637    
638          tdata = (owncolmap ? data : translate_image(width, height, data));          tdata = (owncolmap ? data : translate_image(width, height, data));
639          image = XCreateImage(display, visual, depth, ZPixmap, 0, tdata, width,          image = XCreateImage(display, visual, depth, ZPixmap, 0,
640                               height, 8, 0);                               (char *) tdata, width, height, 8, 0);
641    
642          if (ownbackstore)          if (ownbackstore)
643          {          {
# Line 645  ui_create_glyph(int width, int height, u Line 673  ui_create_glyph(int width, int height, u
673          bitmap = XCreatePixmap(display, wnd, width, height, 1);          bitmap = XCreatePixmap(display, wnd, width, height, 1);
674          gc = XCreateGC(display, bitmap, 0, NULL);          gc = XCreateGC(display, bitmap, 0, NULL);
675    
676          image = XCreateImage(display, visual, 1, ZPixmap, 0, data, width,          image = XCreateImage(display, visual, 1, ZPixmap, 0, (char *) data,
677                               height, 8, scanline);                               width, height, 8, scanline);
678          image->byte_order = MSBFirst;          image->byte_order = MSBFirst;
679          image->bitmap_bit_order = MSBFirst;          image->bitmap_bit_order = MSBFirst;
680          XInitImage(image);          XInitImage(image);
# Line 892  ui_patblt(uint8 opcode, Line 920  ui_patblt(uint8 opcode,
920                          FILL_RECTANGLE(x, y, cx, cy);                          FILL_RECTANGLE(x, y, cx, cy);
921    
922                          XSetFillStyle(display, gc, FillSolid);                          XSetFillStyle(display, gc, FillSolid);
923                            XSetTSOrigin(display, gc, 0, 0);
924                          ui_destroy_glyph((HGLYPH) fill);                          ui_destroy_glyph((HGLYPH) fill);
925                          break;                          break;
926    
# Line 1016  ui_draw_glyph(int mixmode, Line 1045  ui_draw_glyph(int mixmode,
1045        if ((xyoffset & 0x80))\        if ((xyoffset & 0x80))\
1046          {\          {\
1047            if (flags & TEXT2_VERTICAL) \            if (flags & TEXT2_VERTICAL) \
1048              y += ttext[++idx] | (ttext[++idx] << 8);\              y += ttext[idx+1] | (ttext[idx+2] << 8);\
1049            else\            else\
1050              x += ttext[++idx] | (ttext[++idx] << 8);\              x += ttext[idx+1] | (ttext[idx+2] << 8);\
1051              idx += 2;\
1052          }\          }\
1053        else\        else\
1054          {\          {\
# Line 1156  ui_desktop_restore(uint32 offset, int x, Line 1186  ui_desktop_restore(uint32 offset, int x,
1186          if (data == NULL)          if (data == NULL)
1187                  return;                  return;
1188    
1189          image = XCreateImage(display, visual, depth, ZPixmap, 0, data, cx, cy,          image = XCreateImage(display, visual, depth, ZPixmap, 0,
1190                               BitmapPad(display), cx * bpp / 8);                               (char *) data, cx, cy, BitmapPad(display),
1191                                 cx * bpp / 8);
1192    
1193          if (ownbackstore)          if (ownbackstore)
1194          {          {

Legend:
Removed from v.70  
changed lines
  Added in v.81

  ViewVC Help
Powered by ViewVC 1.1.26