/[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 192 by matthewc, Tue Sep 24 07:59:14 2002 UTC revision 196 by astrand, Wed Sep 25 11:07:12 2002 UTC
# Line 278  ui_init(void) Line 278  ui_init(void)
278    
279          if (ownbackstore)          if (ownbackstore)
280          {          {
281                  backstore = XCreatePixmap(display, RootWindowOfScreen(screen), width, height, depth);                  backstore =
282                            XCreatePixmap(display, RootWindowOfScreen(screen), width, height, depth);
283    
284                  /* clear to prevent rubbish being exposed at startup */                  /* clear to prevent rubbish being exposed at startup */
285                  XSetForeground(display, gc, BlackPixelOfScreen(screen));                  XSetForeground(display, gc, BlackPixelOfScreen(screen));
# Line 316  ui_create_window(void) Line 317  ui_create_window(void)
317          long input_mask, ic_input_mask;          long input_mask, ic_input_mask;
318          XEvent xevent;          XEvent xevent;
319    
320          wndwidth  = fullscreen ? WidthOfScreen(screen)  : width;          wndwidth = fullscreen ? WidthOfScreen(screen) : width;
321          wndheight = fullscreen ? HeightOfScreen(screen) : height;          wndheight = fullscreen ? HeightOfScreen(screen) : height;
322    
323          attribs.background_pixel = BlackPixelOfScreen(screen);          attribs.background_pixel = BlackPixelOfScreen(screen);
# Line 350  ui_create_window(void) Line 351  ui_create_window(void)
351          input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |          input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
352                  StructureNotifyMask | FocusChangeMask;                  StructureNotifyMask | FocusChangeMask;
353    
         if (grab_keyboard)  
                 input_mask |= EnterWindowMask | LeaveWindowMask;  
354          if (sendmotion)          if (sendmotion)
355                  input_mask |= PointerMotionMask;                  input_mask |= PointerMotionMask;
356          if (ownbackstore)          if (ownbackstore)
# Line 362  ui_create_window(void) Line 361  ui_create_window(void)
361                  IC = XCreateIC(IM, XNInputStyle, (XIMPreeditNothing | XIMStatusNothing),                  IC = XCreateIC(IM, XNInputStyle, (XIMPreeditNothing | XIMStatusNothing),
362                                 XNClientWindow, wnd, XNFocusWindow, wnd, NULL);                                 XNClientWindow, wnd, XNFocusWindow, wnd, NULL);
363    
364                  if ((IC != NULL) && (XGetICValues(IC, XNFilterEvents, &ic_input_mask, NULL) == NULL))                  if ((IC != NULL)
365                        && (XGetICValues(IC, XNFilterEvents, &ic_input_mask, NULL) == NULL))
366                          input_mask |= ic_input_mask;                          input_mask |= ic_input_mask;
367          }          }
368    
# Line 370  ui_create_window(void) Line 370  ui_create_window(void)
370          XMapWindow(display, wnd);          XMapWindow(display, wnd);
371    
372          /* wait for MapNotify */          /* wait for MapNotify */
373          do {          do
374            {
375                  XMaskEvent(display, StructureNotifyMask, &xevent);                  XMaskEvent(display, StructureNotifyMask, &xevent);
376          } while (xevent.type != MapNotify);          }
377            while (xevent.type != MapNotify);
378    
379          if (fullscreen)          if (fullscreen)
380                  XSetInputFocus(display, wnd, RevertToPointerRoot, CurrentTime);                  XSetInputFocus(display, wnd, RevertToPointerRoot, CurrentTime);
# Line 518  xwin_process_events(void) Line 520  xwin_process_events(void)
520                                                 MOUSE_FLAG_MOVE, xevent.xmotion.x, xevent.xmotion.y);                                                 MOUSE_FLAG_MOVE, xevent.xmotion.x, xevent.xmotion.y);
521                                  break;                                  break;
522    
523                          case EnterNotify:                          case FocusIn:
524                                    reset_modifier_keys();
525                                  if (grab_keyboard)                                  if (grab_keyboard)
526                                          XGrabKeyboard(display, wnd, True,                                          XGrabKeyboard(display, wnd, True,
527                                                        GrabModeAsync, GrabModeAsync, CurrentTime);                                                        GrabModeAsync, GrabModeAsync, CurrentTime);
528                                  break;                                  break;
529    
530                          case LeaveNotify:                          case FocusOut:
531                                  if (grab_keyboard)                                  if (grab_keyboard)
532                                          XUngrabKeyboard(display, CurrentTime);                                          XUngrabKeyboard(display, CurrentTime);
533                                  break;                                  break;
534    
                         case FocusIn:  
                                 reset_modifier_keys();  
                                 break;  
   
535                          case Expose:                          case Expose:
536                                  XCopyArea(display, backstore, wnd, gc,                                  XCopyArea(display, backstore, wnd, gc,
537                                            xevent.xexpose.x, xevent.xexpose.y,                                            xevent.xexpose.x, xevent.xexpose.y,
# Line 784  ui_create_colourmap(COLOURMAP * colours) Line 783  ui_create_colourmap(COLOURMAP * colours)
783                          long nDist = nMinDist;                          long nDist = nMinDist;
784    
785                          /* only get the colors once */                          /* only get the colors once */
786                          while( colLookup-- ){                          while (colLookup--)
787                            {
788                                  xc_cache[colLookup].pixel = colLookup;                                  xc_cache[colLookup].pixel = colLookup;
789                                  xc_cache[colLookup].red = xc_cache[colLookup].green = xc_cache[colLookup].blue = 0;                                  xc_cache[colLookup].red = xc_cache[colLookup].green =
790                                            xc_cache[colLookup].blue = 0;
791                                  xc_cache[colLookup].flags = 0;                                  xc_cache[colLookup].flags = 0;
792                                  XQueryColor(display, DefaultColormap(display, DefaultScreen(display)), &xc_cache[colLookup]);                                  XQueryColor(display,
793                                                DefaultColormap(display, DefaultScreen(display)),
794                                                &xc_cache[colLookup]);
795                          }                          }
796                          colLookup = 0;                          colLookup = 0;
797    
798                          /* approximate the pixel */                          /* approximate the pixel */
799                          while( j-- ){                          while (j--)
800                                  if( xc_cache[j].flags ){                          {
801                                          nDist =                                  if (xc_cache[j].flags)
802                                          ((long) (xc_cache[j].red >> 8) - (long) (xentry.red >> 8)) *                                  {
803                                          ((long) (xc_cache[j].red >> 8) - (long) (xentry.red >> 8)) +                                          nDist = ((long) (xc_cache[j].red >> 8) -
804                                          ((long) (xc_cache[j].green >> 8) - (long) (xentry.green >> 8)) *                                                   (long) (xentry.red >> 8)) *
805                                          ((long) (xc_cache[j].green >> 8) - (long) (xentry.green >> 8)) +                                                  ((long) (xc_cache[j].red >> 8) -
806                                          ((long) (xc_cache[j].blue >> 8) - (long) (xentry.blue >> 8)) *                                                   (long) (xentry.red >> 8)) +
807                                          ((long) (xc_cache[j].blue >> 8) - (long) (xentry.blue >> 8));                                                  ((long) (xc_cache[j].green >> 8) -
808                                                     (long) (xentry.green >> 8)) *
809                                                    ((long) (xc_cache[j].green >> 8) -
810                                                     (long) (xentry.green >> 8)) +
811                                                    ((long) (xc_cache[j].blue >> 8) -
812                                                     (long) (xentry.blue >> 8)) *
813                                                    ((long) (xc_cache[j].blue >> 8) -
814                                                     (long) (xentry.blue >> 8));
815                                  }                                  }
816                                  if( nDist < nMinDist ){                                  if (nDist < nMinDist)
817                                    {
818                                          nMinDist = nDist;                                          nMinDist = nDist;
819                                          xentry.pixel = j;                                          xentry.pixel = j;
820                                  }                                  }
# Line 812  ui_create_colourmap(COLOURMAP * colours) Line 823  ui_create_colourmap(COLOURMAP * colours)
823                  colour = xentry.pixel;                  colour = xentry.pixel;
824    
825                  /* update our cache */                  /* update our cache */
826                  if( xentry.pixel < 256 ){                  if (xentry.pixel < 256)
827                    {
828                          xc_cache[xentry.pixel].red = xentry.red;                          xc_cache[xentry.pixel].red = xentry.red;
829                          xc_cache[xentry.pixel].green = xentry.green;                          xc_cache[xentry.pixel].green = xentry.green;
830                          xc_cache[xentry.pixel].blue = xentry.blue;                          xc_cache[xentry.pixel].blue = xentry.blue;

Legend:
Removed from v.192  
changed lines
  Added in v.196

  ViewVC Help
Powered by ViewVC 1.1.26