/[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 194 by matthewc, Tue Sep 24 12:25:21 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 360  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 368  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 779  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 807  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.194  
changed lines
  Added in v.196

  ViewVC Help
Powered by ViewVC 1.1.26