/[gxemul]/upstream/0.4.1/src/x11.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 /upstream/0.4.1/src/x11.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6 by dpavlin, Mon Oct 8 16:18:11 2007 UTC revision 28 by dpavlin, Mon Oct 8 16:20:26 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2006  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *   *
27   *   *
28   *  $Id: x11.c,v 1.58 2005/05/20 22:35:59 debug Exp $   *  $Id: x11.c,v 1.62 2006/07/08 12:30:02 debug Exp $
29   *   *
30   *  X11-related functions.   *  X11-related functions.
31   */   */
# Line 67  void x11_check_event(struct emul **emuls Line 67  void x11_check_event(struct emul **emuls
67   *  x11_redraw_cursor():   *  x11_redraw_cursor():
68   *   *
69   *  Redraw a framebuffer's X11 cursor.   *  Redraw a framebuffer's X11 cursor.
70     *
71     *  NOTE: It is up to the caller to call XFlush.
72   */   */
73  void x11_redraw_cursor(struct machine *m, int i)  void x11_redraw_cursor(struct machine *m, int i)
74  {  {
# Line 178  void x11_redraw_cursor(struct machine *m Line 180  void x11_redraw_cursor(struct machine *m
180                      m->fb_windows[i]->cursor_xsize;                      m->fb_windows[i]->cursor_xsize;
181                  m->fb_windows[i]->OLD_cursor_ysize =                  m->fb_windows[i]->OLD_cursor_ysize =
182                      m->fb_windows[i]->cursor_ysize;                      m->fb_windows[i]->cursor_ysize;
                 XFlush(m->fb_windows[i]->x11_display);  
183          }          }
184    
185          /*  printf("n_colors_used = %i\n", n_colors_used);  */          /*  printf("n_colors_used = %i\n", n_colors_used);  */
# Line 187  void x11_redraw_cursor(struct machine *m Line 188  void x11_redraw_cursor(struct machine *m
188                  /*  Remove the old X11 host cursor:  */                  /*  Remove the old X11 host cursor:  */
189                  XUndefineCursor(m->fb_windows[i]->x11_display,                  XUndefineCursor(m->fb_windows[i]->x11_display,
190                      m->fb_windows[i]->x11_fb_window);                      m->fb_windows[i]->x11_fb_window);
                 XFlush(m->fb_windows[i]->x11_display);  
191                  XFreeCursor(m->fb_windows[i]->x11_display,                  XFreeCursor(m->fb_windows[i]->x11_display,
192                      m->fb_windows[i]->host_cursor);                      m->fb_windows[i]->host_cursor);
193                  m->fb_windows[i]->host_cursor = 0;                  m->fb_windows[i]->host_cursor = 0;
# Line 231  void x11_redraw_cursor(struct machine *m Line 231  void x11_redraw_cursor(struct machine *m
231                          XDefineCursor(m->fb_windows[i]->x11_display,                          XDefineCursor(m->fb_windows[i]->x11_display,
232                              m->fb_windows[i]->x11_fb_window,                              m->fb_windows[i]->x11_fb_window,
233                              m->fb_windows[i]->host_cursor);                              m->fb_windows[i]->host_cursor);
                         XFlush(m->fb_windows[i]->x11_display);  
234                  }                  }
235          }          }
236  }  }
# Line 378  void x11_fb_resize(struct fb_window *win Line 377  void x11_fb_resize(struct fb_window *win
377    
378    
379  /*  /*
380     *  x11_set_standard_properties():
381     *
382     *  Right now, this only sets the title of a window.
383     */
384    void x11_set_standard_properties(struct fb_window *fb_window, char *name)
385    {
386            XSetStandardProperties(fb_window->x11_display,
387                fb_window->x11_fb_window, name,
388    #ifdef VERSION
389                "GXemul-" VERSION,
390    #else
391                "GXemul",
392    #endif
393                None, NULL, 0, NULL);
394    }
395    
396    
397    /*
398   *  x11_fb_init():   *  x11_fb_init():
399   *   *
400   *  Initialize a framebuffer window.   *  Initialize a framebuffer window.
# Line 456  struct fb_window *x11_fb_init(int xsize, Line 473  struct fb_window *x11_fb_init(int xsize,
473                  debug("WARNING! X11 screen depth is not enough for color; "                  debug("WARNING! X11 screen depth is not enough for color; "
474                      "using only 16 grayscales instead\n");                      "using only 16 grayscales instead\n");
475    
476          strcpy(bg, "Black");          strlcpy(bg, "Black", sizeof(bg));
477          strcpy(fg, "White");          strlcpy(fg, "White", sizeof(fg));
478    
479          XParseColor(x11_display, DefaultColormap(x11_display,          XParseColor(x11_display, DefaultColormap(x11_display,
480              m->fb_windows[fb_number]->x11_screen), fg, &tmpcolor);              m->fb_windows[fb_number]->x11_screen), fg, &tmpcolor);
# Line 500  struct fb_window *x11_fb_init(int xsize, Line 517  struct fb_window *x11_fb_init(int xsize,
517              m->fb_windows[fb_number]->x11_fb_winysize,              m->fb_windows[fb_number]->x11_fb_winysize,
518              0, CopyFromParent, InputOutput, CopyFromParent, 0,0);              0, CopyFromParent, InputOutput, CopyFromParent, 0,0);
519    
520          XSetStandardProperties(x11_display,          m->fb_windows[fb_number]->x11_display = x11_display;
521              m->fb_windows[fb_number]->x11_fb_window, name,  
522  #ifdef VERSION          x11_set_standard_properties(m->fb_windows[fb_number], name);
523              "GXemul-" VERSION,  
 #else  
             "GXemul",  
 #endif  
             None, NULL, 0, NULL);  
524          XSelectInput(x11_display, m->fb_windows[fb_number]->x11_fb_window,          XSelectInput(x11_display, m->fb_windows[fb_number]->x11_fb_window,
525              StructureNotifyMask | ExposureMask | ButtonPressMask |              StructureNotifyMask | ExposureMask | ButtonPressMask |
526              ButtonReleaseMask | PointerMotionMask | KeyPressMask);              ButtonReleaseMask | PointerMotionMask | KeyPressMask);
# Line 526  struct fb_window *x11_fb_init(int xsize, Line 539  struct fb_window *x11_fb_init(int xsize,
539              m->fb_windows[fb_number]->x11_fb_winxsize,              m->fb_windows[fb_number]->x11_fb_winxsize,
540              m->fb_windows[fb_number]->x11_fb_winysize);              m->fb_windows[fb_number]->x11_fb_winysize);
541    
         m->fb_windows[fb_number]->x11_display = x11_display;  
542          m->fb_windows[fb_number]->scaledown   = scaledown;          m->fb_windows[fb_number]->scaledown   = scaledown;
543    
544          m->fb_windows[fb_number]->fb_number = fb_number;          m->fb_windows[fb_number]->fb_number = fb_number;

Legend:
Removed from v.6  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26