From 78e0faae00587efa0a247f3de706772d9facfa8f Mon Sep 17 00:00:00 2001 From: Adam Endrodi Date: Thu, 2 Dec 2010 14:10:08 +0200 Subject: make test13.py and test14.py pass They relied on hardcoded display resolution. * tests/windowctl/windowctl.cpp: Added the 'D' command to obtain the current display resolution. * tests/functional/test13.py * tests/functional/test14.py: Use it. --- tests/functional/test13.py | 3 ++- tests/functional/test14.py | 2 +- tests/windowctl/windowctl.cpp | 14 +++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/functional/test13.py b/tests/functional/test13.py index 47ed3f4..8df09bc 100755 --- a/tests/functional/test13.py +++ b/tests/functional/test13.py @@ -25,7 +25,8 @@ def get_window_size(w): break return ret -(fs_w, fs_h) = (864, 480) +(fs_w, fs_h) = [ int(x) for x in os.popen("windowctl D").readline().split() ] + # map non-fullscreen application window fd = os.popen('windowctl n') diff --git a/tests/functional/test14.py b/tests/functional/test14.py index b772a86..cc35dd5 100755 --- a/tests/functional/test14.py +++ b/tests/functional/test14.py @@ -26,7 +26,7 @@ def get_window_size(w): break return ret -(fs_w, fs_h) = (864, 480) +(fs_w, fs_h) = [ int(x) for x in os.popen("windowctl D").readline().split() ] # map fullscreen application window fd = os.popen('windowctl fn') diff --git a/tests/windowctl/windowctl.cpp b/tests/windowctl/windowctl.cpp index 6ddb5c6..325c8be 100644 --- a/tests/windowctl/windowctl.cpp +++ b/tests/windowctl/windowctl.cpp @@ -22,8 +22,7 @@ #include #include -#define WIN_W 864 -#define WIN_H 480 +static int WIN_W, WIN_H; static Atom win_type_atom, trans_for_atom, workarea_atom; static int xerror_happened; @@ -411,7 +410,9 @@ static void print_usage_and_exit(QString& stdOut) "X - set _MEEGOTOUCH_MSTATUSBAR_GEOMETRY of window to (x y w h)\n" "Usage 9: " PROG " CM \n" "CM - send a ClientMessage (where window=) to window " - "(0 = the root window)\n" + "(0 assumed that = the root window)\n" + "Usage 10: " PROG " D\n" + "D - print the display resolution\n" ; } @@ -657,6 +658,9 @@ static bool old_main(QStringList& args, QString& stdOut) /* catch X errors */ XSetErrorHandler (error_handler); + WIN_W = DisplayWidth(dpy, DefaultScreen(dpy)); + WIN_H = DisplayHeight(dpy, DefaultScreen(dpy)); + win_type_atom = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); /*trans_for_atom = XInternAtom(dpy, "WM_TRANSIENT_FOR", False);*/ workarea_atom = XInternAtom(dpy, "_NET_WORKAREA", False); @@ -859,6 +863,10 @@ static bool old_main(QStringList& args, QString& stdOut) XSync(dpy, False); return true; } + if (*p == 'D') { + printf("%u %u\n", WIN_W, WIN_H); + return true; + } if ((command = strchr("NUFCMTAWHSO", *p))) { if (args.count() != 2) { print_usage_and_exit(stdOut); -- cgit v1.2.3