|
|
| version 1.1, 2004/07/14 16:01:40 | version 1.2, 2004/07/27 17:07:50 |
|---|---|
| Line 27 | Line 27 |
| #include "compiler.h" | #include "compiler.h" |
| #include <errno.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include "gtk2/xnp2.h" | #include "gtk2/xnp2.h" |
| #include <gdk/gdkx.h> | #include <gdk/gdkx.h> |
| Line 52 gdk_window_set_pointer(GdkWindow *w, gin | Line 48 gdk_window_set_pointer(GdkWindow *w, gin |
| Display *xdisplay; | Display *xdisplay; |
| Window xwindow; | Window xwindow; |
| if (w) { | g_return_if_fail(w != NULL); |
| xdisplay = GDK_WINDOW_XDISPLAY(w); | |
| xwindow = GDK_WINDOW_XWINDOW(w); | xdisplay = GDK_WINDOW_XDISPLAY(w); |
| XWarpPointer(xdisplay, None, xwindow, 0, 0, 0, 0, x, y); | xwindow = GDK_WINDOW_XWINDOW(w); |
| } | XWarpPointer(xdisplay, None, xwindow, 0, 0, 0, 0, x, y); |
| } | } |
| int | BOOL |
| is_32bpp(GdkWindow *w) | gdk_window_get_pixmap_format(GdkWindow *w, GdkVisual *visual, pixmap_format_t *fmtp) |
| { | { |
| Display *xdisplay; | Display *xdisplay; |
| XPixmapFormatValues *format; | XPixmapFormatValues *format; |
| int nbit = 0; | |
| int count; | int count; |
| int i; | int i; |
| if (w == NULL) | g_return_val_if_fail(w != NULL, FALSE); |
| return 0; | g_return_val_if_fail(visual != NULL, FALSE); |
| g_return_val_if_fail(fmtp != NULL, FALSE); | |
| xdisplay = GDK_WINDOW_XDISPLAY(w); | xdisplay = GDK_WINDOW_XDISPLAY(w); |
| format = XListPixmapFormats(xdisplay, &count); | format = XListPixmapFormats(xdisplay, &count); |
| if (format != 0) { | if (format) { |
| for (i = 0; i < count; i++) { | for (i = 0; i < count; i++) { |
| if (format[i].depth != 24) | if (visual->depth == format[i].depth) { |
| continue; | fmtp->depth = format[i].depth; |
| fmtp->bits_per_pixel = format[i].bits_per_pixel; | |
| if (format[i].bits_per_pixel == 32) { | fmtp->scanline_pad = format[i].scanline_pad; |
| nbit = 32; | XFree(format); |
| } else { | return TRUE; |
| nbit = 24; | |
| } | } |
| break; | |
| } | } |
| XFree(format); | XFree(format); |
| if (i == count) { | |
| fprintf(stderr, "24bpp depth not support?\n"); | |
| return 0; | |
| } | |
| } else { | |
| fprintf(stderr, "Can't get PixmapFormats.\n"); | |
| return 0; | |
| } | } |
| return (nbit == 32) ? 1 : 0; | return FALSE; |
| } | } |