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: |
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 |
*/ |
*/ |
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 |
{ |
{ |
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); */ |
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; |
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 |
} |
} |
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. |
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); |
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); |
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; |