| File: | wm-tester/test-size-hints.c |
| Warning: | line 92, column 11 Value stored to 'y' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | #include <X11/Xlib.h> |
| 2 | #include <X11/Xutil.h> |
| 3 | #include <stdlib.h> |
| 4 | #include <glib.h> |
| 5 | |
| 6 | static Boolint |
| 7 | all_events (Display *display, |
| 8 | XEvent *event, |
| 9 | XPointer arg) |
| 10 | { |
| 11 | return True1; |
| 12 | } |
| 13 | |
| 14 | #if 0 |
| 15 | static void |
| 16 | get_size (Display *d, Drawable draw, |
| 17 | int *xp, int *yp, int *widthp, int *heightp) |
| 18 | { |
| 19 | int x, y; |
| 20 | unsigned int width, height, border, depth; |
| 21 | Window root; |
| 22 | |
| 23 | XGetGeometry (d, draw, &root, &x, &y, &width, &height, &border, &depth); |
| 24 | |
| 25 | if (xp) |
| 26 | *xp = x; |
| 27 | if (yp) |
| 28 | *yp = y; |
| 29 | if (widthp) |
| 30 | *widthp = width; |
| 31 | if (*heightp) |
| 32 | *heightp = height; |
| 33 | } |
| 34 | #endif |
| 35 | |
| 36 | int |
| 37 | main (int argc, char **argv) |
| 38 | { |
| 39 | Display *d; |
| 40 | Window zero_min_size; |
| 41 | XSizeHints hints; |
| 42 | int screen; |
| 43 | XEvent ev; |
| 44 | int x, y, width, height; |
| 45 | Pixmap pix; |
| 46 | GC gc; |
| 47 | XGCValues gc_vals; |
| 48 | gboolean redraw_pending; |
| 49 | |
| 50 | d = XOpenDisplay (NULL((void*)0)); |
| 51 | |
| 52 | screen = DefaultScreen (d)(((_XPrivDisplay)(d))->default_screen); |
| 53 | |
| 54 | x = 0; |
| 55 | y = 0; |
| 56 | width = 100; |
| 57 | height = 100; |
| 58 | |
| 59 | zero_min_size = XCreateSimpleWindow (d, RootWindow (d, screen)((&((_XPrivDisplay)(d))->screens[screen])->root), |
| 60 | x, y, width, height, 0, |
| 61 | WhitePixel (d, screen)((&((_XPrivDisplay)(d))->screens[screen])->white_pixel ), |
| 62 | WhitePixel (d, screen)((&((_XPrivDisplay)(d))->screens[screen])->white_pixel )); |
| 63 | |
| 64 | XSelectInput (d, zero_min_size, |
| 65 | ButtonPressMask(1L<<2) | ExposureMask(1L<<15) | StructureNotifyMask(1L<<17)); |
| 66 | |
| 67 | hints.flags = PMinSize(1L << 4); |
| 68 | |
| 69 | hints.min_width = 0; |
| 70 | hints.min_height = 0; |
| 71 | |
| 72 | XSetWMNormalHints (d, zero_min_size, &hints); |
| 73 | XMapWindow (d, zero_min_size); |
| 74 | |
| 75 | redraw_pending = FALSE(0); |
| 76 | while (1) |
| 77 | { |
| 78 | XNextEvent (d, &ev); |
| 79 | |
| 80 | switch (ev.xany.type) |
| 81 | { |
| 82 | case ButtonPress4: |
| 83 | if (ev.xbutton.button == 1) |
| 84 | { |
| 85 | g_print ("Exiting on button 1 press\n"); |
| 86 | exit (0); |
| 87 | } |
| 88 | break; |
| 89 | |
| 90 | case ConfigureNotify22: |
| 91 | x = ev.xconfigure.x; |
| 92 | y = ev.xconfigure.y; |
Value stored to 'y' is never read | |
| 93 | width = ev.xconfigure.width; |
| 94 | height = ev.xconfigure.height; |
| 95 | |
| 96 | redraw_pending = TRUE(!(0)); |
| 97 | break; |
| 98 | |
| 99 | case Expose12: |
| 100 | redraw_pending = TRUE(!(0)); |
| 101 | break; |
| 102 | |
| 103 | default: |
| 104 | break; |
| 105 | } |
| 106 | |
| 107 | /* Primitive event compression */ |
| 108 | if (XCheckIfEvent (d, &ev, all_events, NULL((void*)0))) |
| 109 | { |
| 110 | XPutBackEvent (d, &ev); |
| 111 | } |
| 112 | else if (redraw_pending) |
| 113 | { |
| 114 | pix = XCreatePixmap (d, zero_min_size, width, height, |
| 115 | DefaultDepth (d, screen)((&((_XPrivDisplay)(d))->screens[screen])->root_depth )); |
| 116 | |
| 117 | gc_vals.foreground = WhitePixel (d, screen)((&((_XPrivDisplay)(d))->screens[screen])->white_pixel ); |
| 118 | |
| 119 | gc = XCreateGC (d, pix, GCForeground(1L<<2), &gc_vals); |
| 120 | |
| 121 | XFillRectangle (d, pix, gc, 0, 0, width, height); |
| 122 | |
| 123 | XCopyArea (d, pix, zero_min_size, gc, 0, 0, width, height, 0, 0); |
| 124 | |
| 125 | XFreePixmap (d, pix); |
| 126 | XFreeGC (d, gc); |
| 127 | |
| 128 | redraw_pending = FALSE(0); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | /* This program has an infinite loop above so a return statement would |
| 133 | * just cause compiler warnings. |
| 134 | */ |
| 135 | } |
| 136 |