diff options
Diffstat (limited to 'src/wm-tester')
-rw-r--r-- | src/wm-tester/focus-window.c | 8 | ||||
-rw-r--r-- | src/wm-tester/main.c | 60 | ||||
-rw-r--r-- | src/wm-tester/test-gravity.c | 68 | ||||
-rw-r--r-- | src/wm-tester/test-resizing.c | 70 | ||||
-rw-r--r-- | src/wm-tester/test-size-hints.c | 36 |
5 files changed, 121 insertions, 121 deletions
diff --git a/src/wm-tester/focus-window.c b/src/wm-tester/focus-window.c index dc33bd25..01cb4d3e 100644 --- a/src/wm-tester/focus-window.c +++ b/src/wm-tester/focus-window.c @@ -9,18 +9,18 @@ int main (int argc, char **argv) Window w; const char *w_str; char *end; - + if (argc != 2) { fprintf (stderr, "Usage: focus-window WINDOWID\n"); exit (1); } - + d = XOpenDisplay (NULL); w_str = argv[1]; end = NULL; - + w = strtoul (w_str, &end, 16); if (end == w_str) { @@ -31,7 +31,7 @@ int main (int argc, char **argv) printf ("Setting input focus to 0x%lx\n", w); XSetInputFocus (d, w, RevertToPointerRoot, CurrentTime); XFlush (d); - + return 0; } diff --git a/src/wm-tester/main.c b/src/wm-tester/main.c index 48a23a06..f970075f 100644 --- a/src/wm-tester/main.c +++ b/src/wm-tester/main.c @@ -1,8 +1,8 @@ /* WM tester main() */ -/* +/* * Copyright (C) 2001 Havoc Pennington - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the @@ -12,7 +12,7 @@ * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA @@ -43,17 +43,17 @@ main (int argc, char **argv) int i; gboolean do_evil; gboolean do_icon_windows; - - gtk_init (&argc, &argv); - + + gtk_init (&argc, &argv); + do_evil = FALSE; do_icon_windows = FALSE; - + i = 1; while (i < argc) { const char *arg = argv[i]; - + if (strcmp (arg, "--help") == 0 || strcmp (arg, "-h") == 0 || strcmp (arg, "-?") == 0) @@ -64,20 +64,20 @@ main (int argc, char **argv) do_icon_windows = TRUE; else usage (); - + ++i; } /* Be sure some option was provided */ if (! (do_evil || do_icon_windows)) return 1; - + if (do_evil) set_up_the_evil (); if (do_icon_windows) set_up_icon_windows (); - + gtk_main (); return 0; @@ -93,9 +93,9 @@ evil_timeout (gpointer data) int len; int create_count; int destroy_count; - - len = g_slist_length (evil_windows); - + + len = g_slist_length (evil_windows); + if (len > 35) { create_count = 2; @@ -109,7 +109,7 @@ evil_timeout (gpointer data) /* Create some windows */ n_windows = g_random_int_range (0, create_count); - + i = 0; while (i < n_windows) { @@ -117,7 +117,7 @@ evil_timeout (gpointer data) GtkWidget *c; int t; GtkWidget *parent; - + w = gtk_window_new (GTK_WINDOW_TOPLEVEL); #if GTK_CHECK_VERSION(3, 0, 0) @@ -131,7 +131,7 @@ evil_timeout (gpointer data) gdk_screen_height ())); parent = NULL; - + /* set transient for random window (may create all kinds of weird cycles) */ if (len > 0) { @@ -139,22 +139,22 @@ evil_timeout (gpointer data) if (t >= 0) { parent = g_slist_nth_data (evil_windows, t); - + if (parent != NULL) gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (parent)); } } - + if (parent != NULL) c = gtk_button_new_with_label ("Evil Transient!"); else c = gtk_button_new_with_label ("Evil Window!"); gtk_container_add (GTK_CONTAINER (w), c); - + gtk_widget_show_all (w); - + evil_windows = g_slist_prepend (evil_windows, w); - + ++i; } @@ -166,7 +166,7 @@ evil_timeout (gpointer data) while (i < n_windows) { GtkWidget *w; - + w = g_slist_nth_data (evil_windows, g_random_int_range (0, len)); if (w) @@ -175,11 +175,11 @@ evil_timeout (gpointer data) evil_windows = g_slist_remove (evil_windows, w); gtk_widget_destroy (w); } - + ++i; } } - + return TRUE; } @@ -197,7 +197,7 @@ set_up_icon_windows (void) /* Create some windows */ n_windows = 9; - + i = 0; while (i < n_windows) { @@ -205,7 +205,7 @@ set_up_icon_windows (void) GtkWidget *c; GList *icons; GdkPixbuf *pix; - + w = gtk_window_new (GTK_WINDOW_TOPLEVEL); c = gtk_button_new_with_label ("Icon window"); gtk_container_add (GTK_CONTAINER (w), c); @@ -216,7 +216,7 @@ set_up_icon_windows (void) GTK_STOCK_SAVE, GTK_ICON_SIZE_LARGE_TOOLBAR, NULL); - + icons = g_list_append (icons, pix); if (i % 2) @@ -241,9 +241,9 @@ set_up_icon_windows (void) g_list_foreach (icons, (GFunc) g_object_unref, NULL); g_list_free (icons); - + gtk_widget_show_all (w); - + ++i; } } diff --git a/src/wm-tester/test-gravity.c b/src/wm-tester/test-gravity.c index 8e5b581c..4276549b 100644 --- a/src/wm-tester/test-gravity.c +++ b/src/wm-tester/test-gravity.c @@ -4,11 +4,11 @@ #include <string.h> static int gravities[10] = { - NorthWestGravity, - NorthGravity, + NorthWestGravity, + NorthGravity, NorthEastGravity, - WestGravity, - CenterGravity, + WestGravity, + CenterGravity, EastGravity, SouthWestGravity, SouthGravity, @@ -73,7 +73,7 @@ calculate_position (int i, int doubled, int *x, int *y) *x = 150; *y = 150; } - else + else { int xoff = x_offset[i % 3]; int yoff = y_offset[i / 3]; @@ -82,7 +82,7 @@ calculate_position (int i, int doubled, int *x, int *y) xoff *= 2; yoff *= 2; } - + *x = screen_x_fraction[i % 3] * screen_width + xoff; *y = screen_y_fraction[i / 3] * screen_height + yoff; } @@ -123,12 +123,12 @@ int main (int argc, char **argv) int screen; XEvent ev; int noframes; - + if (argc > 1 && strcmp (argv[1], "--noframes") == 0) noframes = 1; else noframes = 0; - + d = XOpenDisplay (NULL); screen = DefaultScreen (d); @@ -138,11 +138,11 @@ int main (int argc, char **argv) for (i=0; i<10; i++) { int x, y; - + calculate_position (i, doubled[i], &x, &y); - w = XCreateSimpleWindow (d, RootWindow (d, screen), - x, y, WINDOW_WIDTH, WINDOW_HEIGHT, 0, + w = XCreateSimpleWindow (d, RootWindow (d, screen), + x, y, WINDOW_WIDTH, WINDOW_HEIGHT, 0, WhitePixel (d, screen), WhitePixel (d, screen)); windows[i] = w; @@ -150,11 +150,11 @@ int main (int argc, char **argv) window_rects[i].y = y; window_rects[i].width = WINDOW_WIDTH; window_rects[i].height = WINDOW_HEIGHT; - + XSelectInput (d, w, ButtonPressMask | ExposureMask | StructureNotifyMask); - + hints.flags = USPosition | PMinSize | PMaxSize | PWinGravity; - + hints.min_width = WINDOW_WIDTH / 2; hints.min_height = WINDOW_HEIGHT / 2; @@ -170,7 +170,7 @@ int main (int argc, char **argv) hints.max_height = WINDOW_HEIGHT * 2 + WINDOW_HEIGHT / 2; #endif hints.win_gravity = gravities[i]; - + XSetWMNormalHints (d, w, &hints); XStoreName (d, w, window_gravity_to_string (hints.win_gravity)); @@ -179,10 +179,10 @@ int main (int argc, char **argv) { MotifWmHints mwm; Atom mwm_atom; - + mwm.decorations = 0; mwm.flags = MWM_HINTS_DECORATIONS; - + mwm_atom = XInternAtom (d, "_MOTIF_WM_HINTS", False); XChangeProperty (d, w, mwm_atom, mwm_atom, @@ -190,7 +190,7 @@ int main (int argc, char **argv) (unsigned char *)&mwm, sizeof (MotifWmHints)/sizeof (long)); } - + XMapWindow (d, w); } @@ -201,14 +201,14 @@ int main (int argc, char **argv) if (ev.xany.type == ConfigureNotify) { i = find_window (ev.xconfigure.window); - + if (i >= 0) { Window ignored; - + window_rects[i].width = ev.xconfigure.width; window_rects[i].height = ev.xconfigure.height; - + XClearArea (d, windows[i], 0, 0, ev.xconfigure.width, ev.xconfigure.height, @@ -227,17 +227,17 @@ int main (int argc, char **argv) } } else if (ev.xany.type == Expose) - { + { i = find_window (ev.xexpose.window); - + if (i >= 0) { GC gc; XGCValues values; char buf[256]; - + values.foreground = BlackPixel (d, screen); - + gc = XCreateGC (d, windows[i], GCForeground, &values); @@ -245,7 +245,7 @@ int main (int argc, char **argv) "%d,%d", window_rects[i].x, window_rects[i].y); - + XDrawString (d, windows[i], gc, 10, 15, buf, strlen (buf)); @@ -253,10 +253,10 @@ int main (int argc, char **argv) "%dx%d", window_rects[i].width, window_rects[i].height); - + XDrawString (d, windows[i], gc, 10, 35, buf, strlen (buf)); - + XFreeGC (d, gc); } } @@ -267,13 +267,13 @@ int main (int argc, char **argv) if (i >= 0) { /* Button 1 = move, 2 = resize, 3 = both at once */ - - if (ev.xbutton.button == Button1) - { + + if (ev.xbutton.button == Button1) + { int x, y; - + calculate_position (i, doubled[i], &x, &y); - XMoveWindow (d, windows[i], x, y); + XMoveWindow (d, windows[i], x, y); } else if (ev.xbutton.button == Button2) { @@ -287,7 +287,7 @@ int main (int argc, char **argv) else if (ev.xbutton.button == Button3) { int x, y; - + calculate_position (i, !doubled[i], &x, &y); if (doubled[i]) diff --git a/src/wm-tester/test-resizing.c b/src/wm-tester/test-resizing.c index f9481004..344b8325 100644 --- a/src/wm-tester/test-resizing.c +++ b/src/wm-tester/test-resizing.c @@ -17,7 +17,7 @@ calc_rects (XRectangle *rects, int width, int height) rects[i].height = h; ++i; } - + /* NW */ rects[0].x = 0; rects[0].y = 0; @@ -70,7 +70,7 @@ get_size (Display *d, Drawable draw, int x, y; unsigned int width=0, height=0, border=0, depth=0; Window root; - + XGetGeometry (d, draw, &root, &x, &y, &width, &height, &border, &depth); if (xp) @@ -93,20 +93,20 @@ main (int argc, char **argv) XEvent ev; int x, y, width, height; Pixmap pix; - GC gc; + GC gc; XGCValues gc_vals; XSetWindowAttributes set_attrs; XWindowChanges changes; XRectangle rects[9]; gboolean redraw_pending; unsigned int mask; - + d = XOpenDisplay (NULL); screen = DefaultScreen (d); - /* Print some debug spew to show how StaticGravity works */ - w = XCreateSimpleWindow (d, RootWindow (d, screen), + /* Print some debug spew to show how StaticGravity works */ + w = XCreateSimpleWindow (d, RootWindow (d, screen), 0, 0, 100, 100, 0, WhitePixel (d, screen), WhitePixel (d, screen)); @@ -115,21 +115,21 @@ main (int argc, char **argv) WhitePixel (d, screen), WhitePixel (d, screen)); set_attrs.win_gravity = StaticGravity; - + XChangeWindowAttributes (d, cw, CWWinGravity, &set_attrs); - + get_size (d, w, &x, &y, &width, &height); - + g_print ("Parent is %d,%d %d x %d before configuring parent\n", x, y, width, height); - + get_size (d, cw, &x, &y, &width, &height); g_print ("Child is %d,%d %d x %d before configuring parent\n", x, y, width, height); - + changes.x = 10; changes.y = 10; changes.width = 110; @@ -138,7 +138,7 @@ main (int argc, char **argv) mask = CWX | CWY; mask = CWWidth | CWHeight; mask = CWX | CWY | CWWidth | CWHeight; - + XConfigureWindow (d, w, mask, &changes); XSync (d, False); @@ -146,42 +146,42 @@ main (int argc, char **argv) g_print ("Parent is %d,%d %d x %d after configuring parent\n", x, y, width, height); - + get_size (d, cw, &x, &y, &width, &height); g_print ("Child is %d,%d %d x %d after configuring parent\n", - x, y, width, height); + x, y, width, height); XDestroyWindow (d, w); - + /* The window that gets displayed */ - + x = 20; y = 20; width = 100; height = 100; calc_rects (rects, width, height); - - w = XCreateSimpleWindow (d, RootWindow (d, screen), + + w = XCreateSimpleWindow (d, RootWindow (d, screen), x, y, width, height, 0, WhitePixel (d, screen), WhitePixel (d, screen)); - + set_attrs.bit_gravity = StaticGravity; - + XChangeWindowAttributes (d, w, CWBitGravity, &set_attrs); - + XSelectInput (d, w, ButtonPressMask | ExposureMask | StructureNotifyMask); - + hints.flags = PMinSize; - + hints.min_width = 100; hints.min_height = 100; - + XSetWMNormalHints (d, w, &hints); XMapWindow (d, w); @@ -189,7 +189,7 @@ main (int argc, char **argv) while (1) { XNextEvent (d, &ev); - + switch (ev.xany.type) { case ButtonPress: @@ -208,11 +208,11 @@ main (int argc, char **argv) redraw_pending = TRUE; break; - + case Expose: redraw_pending = TRUE; break; - + default: break; } @@ -225,24 +225,24 @@ main (int argc, char **argv) else if (redraw_pending) { calc_rects (rects, width, height); - + pix = XCreatePixmap (d, w, width, height, DefaultDepth (d, screen)); - + gc_vals.foreground = WhitePixel (d, screen); - + gc = XCreateGC (d, pix, GCForeground, &gc_vals); - + XFillRectangle (d, pix, gc, 0, 0, width, height); - + /* Draw rectangles at each gravity point */ gc_vals.foreground = BlackPixel (d, screen); XChangeGC (d, gc, GCForeground, &gc_vals); - + XFillRectangles (d, pix, gc, rects, G_N_ELEMENTS (rects)); - + XCopyArea (d, pix, w, gc, 0, 0, width, height, 0, 0); - + XFreePixmap (d, pix); XFreeGC (d, gc); diff --git a/src/wm-tester/test-size-hints.c b/src/wm-tester/test-size-hints.c index 72f1b486..0569efbd 100644 --- a/src/wm-tester/test-size-hints.c +++ b/src/wm-tester/test-size-hints.c @@ -19,7 +19,7 @@ get_size (Display *d, Drawable draw, int x, y; unsigned int width, height, border, depth; Window root; - + XGetGeometry (d, draw, &root, &x, &y, &width, &height, &border, &depth); if (xp) @@ -43,10 +43,10 @@ main (int argc, char **argv) XEvent ev; int x, y, width, height; Pixmap pix; - GC gc; + GC gc; XGCValues gc_vals; gboolean redraw_pending; - + d = XOpenDisplay (NULL); screen = DefaultScreen (d); @@ -55,20 +55,20 @@ main (int argc, char **argv) y = 0; width = 100; height = 100; - - zero_min_size = XCreateSimpleWindow (d, RootWindow (d, screen), + + zero_min_size = XCreateSimpleWindow (d, RootWindow (d, screen), x, y, width, height, 0, WhitePixel (d, screen), - WhitePixel (d, screen)); - + WhitePixel (d, screen)); + XSelectInput (d, zero_min_size, ButtonPressMask | ExposureMask | StructureNotifyMask); - + hints.flags = PMinSize; - + hints.min_width = 0; hints.min_height = 0; - + XSetWMNormalHints (d, zero_min_size, &hints); XMapWindow (d, zero_min_size); @@ -76,7 +76,7 @@ main (int argc, char **argv) while (1) { XNextEvent (d, &ev); - + switch (ev.xany.type) { case ButtonPress: @@ -95,11 +95,11 @@ main (int argc, char **argv) redraw_pending = TRUE; break; - + case Expose: redraw_pending = TRUE; break; - + default: break; } @@ -113,15 +113,15 @@ main (int argc, char **argv) { pix = XCreatePixmap (d, zero_min_size, width, height, DefaultDepth (d, screen)); - + gc_vals.foreground = WhitePixel (d, screen); - + gc = XCreateGC (d, pix, GCForeground, &gc_vals); - + XFillRectangle (d, pix, gc, 0, 0, width, height); - + XCopyArea (d, pix, zero_min_size, gc, 0, 0, width, height, 0, 0); - + XFreePixmap (d, pix); XFreeGC (d, gc); |