summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2014-10-09 19:08:57 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2014-10-09 19:08:57 +0300
commit5691341e9eb62b27fd9a200b3a15ffb0944a0075 (patch)
treeb581b97f928ee3a780303b5b29aeb714c4baf20c
parent2570d884883f36232747949e07f8f9a0dd27d758 (diff)
downloadmetacity-5691341e9eb62b27fd9a200b3a15ffb0944a0075.tar.gz
remove wm-tester utilities
-rw-r--r--configure.ac1
-rw-r--r--src/Makefile.am2
-rw-r--r--src/wm-tester/Makefile.am27
-rw-r--r--src/wm-tester/focus-window.c37
-rw-r--r--src/wm-tester/main.c238
-rw-r--r--src/wm-tester/test-gravity.c308
-rw-r--r--src/wm-tester/test-resizing.c257
-rw-r--r--src/wm-tester/test-size-hints.c136
8 files changed, 1 insertions, 1005 deletions
diff --git a/configure.ac b/configure.ac
index cd3645d9..4284fcfa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -506,7 +506,6 @@ doc/Makefile
doc/creating_themes/Makefile
doc/man/Makefile
src/Makefile
-src/wm-tester/Makefile
src/libmetacity-private.pc
src/tools/Makefile
src/themes/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index ad9b2b9a..28532948 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
lib_LTLIBRARIES = libmetacity-private.la
-SUBDIRS=wm-tester tools themes
+SUBDIRS = tools themes
AM_CPPFLAGS=-I$(srcdir)/include -DMETACITY_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMETACITY_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" -DMETACITY_PKGDATADIR=\"$(pkgdatadir)\" -DMETACITY_DATADIR=\"$(datadir)\" -DG_LOG_DOMAIN=\"metacity\" -DSN_API_NOT_YET_FROZEN=1 @METACITY_CFLAGS@
diff --git a/src/wm-tester/Makefile.am b/src/wm-tester/Makefile.am
deleted file mode 100644
index 0e0ead03..00000000
--- a/src/wm-tester/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-
-AM_CPPFLAGS=@METACITY_CFLAGS@
-
-wm_tester_SOURCES= \
- main.c
-
-test_gravity_SOURCES= \
- test-gravity.c
-
-focus_window_SOURCES= \
- focus-window.c
-
-test_resizing_SOURCES= \
- test-resizing.c
-
-test_size_hints_SOURCES= \
- test-size-hints.c
-
-noinst_PROGRAMS=wm-tester test-gravity test-resizing focus-window test-size-hints
-
-wm_tester_LDADD= @METACITY_LIBS@
-test_gravity_LDADD= @METACITY_LIBS@
-test_resizing_LDADD= @METACITY_LIBS@
-test_size_hints_LDADD= @METACITY_LIBS@
-focus_window_LDADD= @METACITY_LIBS@
-
--include $(top_srcdir)/git.mk
diff --git a/src/wm-tester/focus-window.c b/src/wm-tester/focus-window.c
deleted file mode 100644
index 01cb4d3e..00000000
--- a/src/wm-tester/focus-window.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int main (int argc, char **argv)
-{
- Display *d;
- 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)
- {
- fprintf (stderr, "Usage: focus-window WINDOWID\n");
- exit (1);
- }
-
- 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
deleted file mode 100644
index c0cbd8fa..00000000
--- a/src/wm-tester/main.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/* 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
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * 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, see <http://www.gnu.org/licenses/>.
- */
-
-#include <gtk/gtk.h>
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-static void set_up_the_evil (void);
-static void set_up_icon_windows (void);
-
-static void
-usage (void)
-{
- g_print ("wm-tester [--evil] [--icon-windows]\n");
- exit (0);
-}
-
-int
-main (int argc, char **argv)
-{
- int i;
- gboolean do_evil;
- gboolean do_icon_windows;
-
- 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)
- usage ();
- else if (strcmp (arg, "--evil") == 0)
- do_evil = TRUE;
- else if (strcmp (arg, "--icon-windows") == 0)
- 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;
-}
-
-static GSList *evil_windows = NULL;
-
-static gint
-evil_timeout (gpointer data)
-{
- int i;
- int n_windows;
- int len;
- int create_count;
- int destroy_count;
-
- len = g_slist_length (evil_windows);
-
- if (len > 35)
- {
- create_count = 2;
- destroy_count = 5;
- }
- else
- {
- create_count = 5;
- destroy_count = 5;
- }
-
- /* Create some windows */
- n_windows = g_random_int_range (0, create_count);
-
- i = 0;
- while (i < n_windows)
- {
- GtkWidget *w;
- GtkWidget *c;
- int t;
- GtkWidget *parent;
-
- w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_window_move (GTK_WINDOW (w),
- g_random_int_range (0,
- gdk_screen_width ()),
- g_random_int_range (0,
- gdk_screen_height ()));
-
- parent = NULL;
-
- /* set transient for random window (may create all kinds of weird cycles) */
- if (len > 0)
- {
- t = g_random_int_range (- (len / 3), len);
- 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;
- }
-
- /* Destroy some windows */
- if (len > destroy_count)
- {
- n_windows = g_random_int_range (0, destroy_count);
- i = 0;
- while (i < n_windows)
- {
- GtkWidget *w;
-
- w = g_slist_nth_data (evil_windows,
- g_random_int_range (0, len));
- if (w)
- {
- --len;
- evil_windows = g_slist_remove (evil_windows, w);
- gtk_widget_destroy (w);
- }
-
- ++i;
- }
- }
-
- return TRUE;
-}
-
-static void
-set_up_the_evil (void)
-{
- g_timeout_add (400, evil_timeout, NULL);
-}
-
-static void
-set_up_icon_windows (void)
-{
- int i;
- int n_windows;
-
- /* Create some windows */
- n_windows = 9;
-
- i = 0;
- while (i < n_windows)
- {
- GtkWidget *w;
- GtkWidget *c;
- GList *icons;
- GdkPixbuf *pix;
- int size = 0;
-
- w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- c = gtk_button_new_with_label ("Icon window");
- gtk_container_add (GTK_CONTAINER (w), c);
-
- icons = NULL;
-
- gtk_icon_size_lookup (GTK_ICON_SIZE_LARGE_TOOLBAR, NULL, &size);
- pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "gtk-save", size, 0, NULL);
-
- icons = g_list_append (icons, pix);
-
- if (i % 2)
- {
- gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, NULL, &size);
- pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "gtk-save", size, 0, NULL);
- icons = g_list_append (icons, pix);
- }
-
- if (i % 3)
- {
- gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, NULL, &size);
- pix = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), "gtk-save", size, 0, NULL);
- icons = g_list_append (icons, pix);
- }
-
- gtk_window_set_icon_list (GTK_WINDOW (w), icons);
-
- 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
deleted file mode 100644
index 4276549b..00000000
--- a/src/wm-tester/test-gravity.c
+++ /dev/null
@@ -1,308 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <stdio.h>
-#include <string.h>
-
-static int gravities[10] = {
- NorthWestGravity,
- NorthGravity,
- NorthEastGravity,
- WestGravity,
- CenterGravity,
- EastGravity,
- SouthWestGravity,
- SouthGravity,
- SouthEastGravity,
- StaticGravity
-};
-
-typedef struct
-{
- int x, y, width, height;
-} Rectangle;
-
-static Window windows[10];
-static int doubled[10] = { 0, };
-static Rectangle window_rects[10];
-
-#define WINDOW_WIDTH 100
-#define WINDOW_HEIGHT 100
-
-static int x_offset[3] = { 0, - WINDOW_WIDTH/2, -WINDOW_WIDTH };
-static int y_offset[3] = { 0, - WINDOW_HEIGHT/2, -WINDOW_HEIGHT };
-static double screen_x_fraction[3] = { 0, 0.5, 1.0 };
-static double screen_y_fraction[3] = { 0, 0.5, 1.0 };
-static int screen_width;
-static int screen_height;
-
-static const char*
-window_gravity_to_string (int gravity)
-{
- switch (gravity)
- {
- case NorthWestGravity:
- return "NorthWestGravity";
- case NorthGravity:
- return "NorthGravity";
- case NorthEastGravity:
- return "NorthEastGravity";
- case WestGravity:
- return "WestGravity";
- case CenterGravity:
- return "CenterGravity";
- case EastGravity:
- return "EastGravity";
- case SouthWestGravity:
- return "SouthWestGravity";
- case SouthGravity:
- return "SouthGravity";
- case SouthEastGravity:
- return "SouthEastGravity";
- case StaticGravity:
- return "StaticGravity";
- default:
- return "NorthWestGravity";
- }
-}
-
-static void
-calculate_position (int i, int doubled, int *x, int *y)
-{
- if (i == 9)
- {
- *x = 150;
- *y = 150;
- }
- else
- {
- int xoff = x_offset[i % 3];
- int yoff = y_offset[i / 3];
- if (doubled)
- {
- xoff *= 2;
- yoff *= 2;
- }
-
- *x = screen_x_fraction[i % 3] * screen_width + xoff;
- *y = screen_y_fraction[i / 3] * screen_height + yoff;
- }
-}
-
-static int
-find_window (Window window)
-{
- int i;
- for (i=0; i<10; i++)
- {
- if (windows[i] == window)
- return i;
- }
-
- return -1;
-}
-
-typedef struct {
- unsigned long flags;
- unsigned long functions;
- unsigned long decorations;
- long input_mode;
- unsigned long status;
-} MotifWmHints, MwmHints;
-
-#define MWM_HINTS_FUNCTIONS (1L << 0)
-#define MWM_HINTS_DECORATIONS (1L << 1)
-#define MWM_HINTS_INPUT_MODE (1L << 2)
-#define MWM_HINTS_STATUS (1L << 3)
-
-int main (int argc, char **argv)
-{
- Display *d;
- Window w;
- XSizeHints hints;
- int i;
- 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);
- screen_width = DisplayWidth (d, screen);
- screen_height = DisplayHeight (d, screen);
-
- 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,
- WhitePixel (d, screen), WhitePixel (d, screen));
-
- windows[i] = w;
- window_rects[i].x = x;
- 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;
-
-#if 1
- /* we constrain max size below the "doubled" size so that
- * the WM will have to deal with constraints
- * at the same time it's dealing with configure request
- */
- hints.max_width = WINDOW_WIDTH * 2 - WINDOW_WIDTH / 2;
- hints.max_height = WINDOW_HEIGHT * 2 - WINDOW_HEIGHT / 2;
-#else
- hints.max_width = WINDOW_WIDTH * 2 + WINDOW_WIDTH / 2;
- 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));
-
- if (noframes)
- {
- 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,
- 32, PropModeReplace,
- (unsigned char *)&mwm,
- sizeof (MotifWmHints)/sizeof (long));
- }
-
- XMapWindow (d, w);
- }
-
- while (1)
- {
- XNextEvent (d, &ev);
-
- 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,
- True);
-
- if (!ev.xconfigure.send_event)
- XTranslateCoordinates (d, windows[i], DefaultRootWindow (d),
- 0, 0,
- &window_rects[i].x, &window_rects[i].y,
- &ignored);
- else
- {
- window_rects[i].x = ev.xconfigure.x;
- window_rects[i].y = ev.xconfigure.y;
- }
- }
- }
- 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);
-
- sprintf (buf,
- "%d,%d",
- window_rects[i].x,
- window_rects[i].y);
-
- XDrawString (d, windows[i], gc, 10, 15,
- buf, strlen (buf));
-
- sprintf (buf,
- "%dx%d",
- window_rects[i].width,
- window_rects[i].height);
-
- XDrawString (d, windows[i], gc, 10, 35,
- buf, strlen (buf));
-
- XFreeGC (d, gc);
- }
- }
- else if (ev.xany.type == ButtonPress)
- {
- i = find_window (ev.xbutton.window);
-
- if (i >= 0)
- {
- /* Button 1 = move, 2 = resize, 3 = both at once */
-
- if (ev.xbutton.button == Button1)
- {
- int x, y;
-
- calculate_position (i, doubled[i], &x, &y);
- XMoveWindow (d, windows[i], x, y);
- }
- else if (ev.xbutton.button == Button2)
- {
- if (doubled[i])
- XResizeWindow (d, windows[i], WINDOW_WIDTH, WINDOW_HEIGHT);
- else
- XResizeWindow (d, windows[i], WINDOW_WIDTH*2, WINDOW_HEIGHT*2);
-
- doubled[i] = !doubled[i];
- }
- else if (ev.xbutton.button == Button3)
- {
- int x, y;
-
- calculate_position (i, !doubled[i], &x, &y);
-
- if (doubled[i])
- XMoveResizeWindow (d, windows[i], x, y, WINDOW_WIDTH, WINDOW_HEIGHT);
- else
- XMoveResizeWindow (d, windows[i], x, y, WINDOW_WIDTH*2, WINDOW_HEIGHT*2);
-
- doubled[i] = !doubled[i];
- }
- }
- }
- }
-
- /* This program has an infinite loop above so a return statement would
- * just cause compiler warnings.
- */
-}
-
diff --git a/src/wm-tester/test-resizing.c b/src/wm-tester/test-resizing.c
deleted file mode 100644
index 344b8325..00000000
--- a/src/wm-tester/test-resizing.c
+++ /dev/null
@@ -1,257 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <stdlib.h>
-#include <glib.h>
-
-static void
-calc_rects (XRectangle *rects, int width, int height)
-{
- int w = (width - 21) / 3;
- int h = (height - 21) / 3;
- int i;
-
- i = 0;
- while (i < 9)
- {
- rects[i].width = w;
- rects[i].height = h;
- ++i;
- }
-
- /* NW */
- rects[0].x = 0;
- rects[0].y = 0;
-
- /* N */
- rects[1].x = width / 2 - w / 2;
- rects[1].y = 0;
-
- /* NE */
- rects[2].x = width - w;
- rects[2].y = 0;
-
- /* E */
- rects[3].x = width - w;
- rects[3].y = height / 2 - h / 2;
-
- /* SE */
- rects[4].x = width - w;
- rects[4].y = height - h;
-
- /* S */
- rects[5].x = width / 2 - w / 2;
- rects[5].y = height - h;
-
- /* SW */
- rects[6].x = 0;
- rects[6].y = height - h;
-
- /* W */
- rects[7].x = 0;
- rects[7].y = height / 2 - h / 2;
-
- /* Center */
- rects[8].x = width / 2 - w / 2;
- rects[8].y = height / 2 - h / 2;
-}
-
-static Bool
-all_events (Display *display,
- XEvent *event,
- XPointer arg)
-{
- return True;
-}
-
-static void
-get_size (Display *d, Drawable draw,
- int *xp, int *yp, int *widthp, int *heightp)
-{
- 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)
- *xp = x;
- if (yp)
- *yp = y;
- if (widthp)
- *widthp = width;
- if (*heightp)
- *heightp = height;
-}
-
-int
-main (int argc, char **argv)
-{
- Display *d;
- Window w, cw;
- XSizeHints hints;
- int screen;
- XEvent ev;
- int x, y, width, height;
- Pixmap pix;
- 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),
- 0, 0, 100, 100, 0,
- WhitePixel (d, screen),
- WhitePixel (d, screen));
- cw = XCreateSimpleWindow (d, w,
- 0, 0, 100, 100, 0,
- 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;
- changes.height = 110;
- /* last mask wins */
- mask = CWX | CWY;
- mask = CWWidth | CWHeight;
- mask = CWX | CWY | CWWidth | CWHeight;
-
- XConfigureWindow (d, w, mask, &changes);
- XSync (d, False);
-
- get_size (d, w, &x, &y, &width, &height);
-
- 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);
-
- 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),
- 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);
-
- redraw_pending = FALSE;
- while (1)
- {
- XNextEvent (d, &ev);
-
- switch (ev.xany.type)
- {
- case ButtonPress:
- if (ev.xbutton.button == 3)
- {
- g_print ("Exiting on button 3 press\n");
- exit (0);
- }
- break;
-
- case ConfigureNotify:
- x = ev.xconfigure.x;
- y = ev.xconfigure.y;
- width = ev.xconfigure.width;
- height = ev.xconfigure.height;
-
- redraw_pending = TRUE;
- break;
-
- case Expose:
- redraw_pending = TRUE;
- break;
-
- default:
- break;
- }
-
- /* Primitive event compression */
- if (XCheckIfEvent (d, &ev, all_events, NULL))
- {
- XPutBackEvent (d, &ev);
- }
- 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);
-
- redraw_pending = FALSE;
- }
- }
-
- /* This program has an infinite loop above so a return statement would
- * just cause compiler warnings.
- */
-}
-
diff --git a/src/wm-tester/test-size-hints.c b/src/wm-tester/test-size-hints.c
deleted file mode 100644
index 0569efbd..00000000
--- a/src/wm-tester/test-size-hints.c
+++ /dev/null
@@ -1,136 +0,0 @@
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <stdlib.h>
-#include <glib.h>
-
-static Bool
-all_events (Display *display,
- XEvent *event,
- XPointer arg)
-{
- return True;
-}
-
-#if 0
-static void
-get_size (Display *d, Drawable draw,
- int *xp, int *yp, int *widthp, int *heightp)
-{
- int x, y;
- unsigned int width, height, border, depth;
- Window root;
-
- XGetGeometry (d, draw, &root, &x, &y, &width, &height, &border, &depth);
-
- if (xp)
- *xp = x;
- if (yp)
- *yp = y;
- if (widthp)
- *widthp = width;
- if (*heightp)
- *heightp = height;
-}
-#endif
-
-int
-main (int argc, char **argv)
-{
- Display *d;
- Window zero_min_size;
- XSizeHints hints;
- int screen;
- XEvent ev;
- int x, y, width, height;
- Pixmap pix;
- GC gc;
- XGCValues gc_vals;
- gboolean redraw_pending;
-
- d = XOpenDisplay (NULL);
-
- screen = DefaultScreen (d);
-
- x = 0;
- y = 0;
- width = 100;
- height = 100;
-
- zero_min_size = XCreateSimpleWindow (d, RootWindow (d, screen),
- x, y, width, height, 0,
- 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);
-
- redraw_pending = FALSE;
- while (1)
- {
- XNextEvent (d, &ev);
-
- switch (ev.xany.type)
- {
- case ButtonPress:
- if (ev.xbutton.button == 1)
- {
- g_print ("Exiting on button 1 press\n");
- exit (0);
- }
- break;
-
- case ConfigureNotify:
- x = ev.xconfigure.x;
- y = ev.xconfigure.y;
- width = ev.xconfigure.width;
- height = ev.xconfigure.height;
-
- redraw_pending = TRUE;
- break;
-
- case Expose:
- redraw_pending = TRUE;
- break;
-
- default:
- break;
- }
-
- /* Primitive event compression */
- if (XCheckIfEvent (d, &ev, all_events, NULL))
- {
- XPutBackEvent (d, &ev);
- }
- else if (redraw_pending)
- {
- 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);
-
- redraw_pending = FALSE;
- }
- }
-
- /* This program has an infinite loop above so a return statement would
- * just cause compiler warnings.
- */
-}
-