Added -test switch to test decorations under another window manager.

This used to be done by recompiling with -DTEST.
This commit is contained in:
Bill Spitzak
2014-11-24 17:32:33 -08:00
parent 7c3b8d7ed0
commit 7981aa60c3

46
main.C
View File

@ -1,7 +1,3 @@
// Define "TEST" and it will compile to make a single fake window so
// you can test the window controls.
//#define TEST 1
#define FL_INTERNALS 1 #define FL_INTERNALS 1
#include "Frame.H" #include "Frame.H"
#include <X11/Xproto.h> #include <X11/Xproto.h>
@ -215,27 +211,30 @@ extern FL_API fltk::Color fl_cursor_bg;
#else #else
static int cursor = FL_CURSOR_ARROW; static int cursor = FL_CURSOR_ARROW;
#endif #endif
bool test_mode = false;
static void initialize() { static void initialize() {
Display* d = fl_display; Display* d = fl_display;
#ifdef TEST if (test_mode) {
XWindow w = XCreateSimpleWindow(d, RootWindow(d, fl_screen), XWindow w = XCreateSimpleWindow(d, RootWindow(d, fl_screen),
100, 100, 200, 300, 10, 100, 100, 200, 300, 10,
BlackPixel(fl_display, 0), BlackPixel(fl_display, 0),
// WhitePixel(fl_display, 0)); // WhitePixel(fl_display, 0));
0x1234); 0x1234);
Frame* frame = new Frame(w); Frame* frame = new Frame(w);
frame->label("flwm test window"); frame->label("flwm test window");
XSelectInput(d, w, XSelectInput(d, w,
ExposureMask | StructureNotifyMask | ExposureMask | StructureNotifyMask |
KeyPressMask | KeyReleaseMask | FocusChangeMask | KeyPressMask | KeyReleaseMask | FocusChangeMask |
KeymapStateMask | KeymapStateMask |
ButtonPressMask | ButtonReleaseMask | ButtonPressMask | ButtonReleaseMask |
EnterWindowMask | LeaveWindowMask /*|PointerMotionMask*/ EnterWindowMask | LeaveWindowMask /*|PointerMotionMask*/
); );
#else
return;
}
Fl::add_handler(flwm_event_handler); Fl::add_handler(flwm_event_handler);
@ -316,8 +315,6 @@ static void initialize() {
(void)new Frame(wins[i],&attr); (void)new Frame(wins[i],&attr);
} }
XFree((void *)wins); XFree((void *)wins);
#endif
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -337,6 +334,10 @@ int arg(int argc, char **argv, int &i) {
exit_flag = 1; exit_flag = 1;
i++; i++;
return 1; return 1;
} else if (!strcmp(s, "test")) {
test_mode = true;
i++;
return 1;
} }
// do switches with a value: // do switches with a value:
@ -398,6 +399,7 @@ int main(int argc, char** argv) {
" -c[ursor] #\t\tCursor number for root\n" " -c[ursor] #\t\tCursor number for root\n"
" -cfg color\t\tCursor color\n" " -cfg color\t\tCursor color\n"
" -cbg color\t\tCursor outline color" " -cbg color\t\tCursor outline color"
" -test\t\t\tTest the window graphics"
); );
#ifndef FL_NORMAL_SIZE // detect new versions of fltk where this is a variable #ifndef FL_NORMAL_SIZE // detect new versions of fltk where this is a variable
FL_NORMAL_SIZE = 12; FL_NORMAL_SIZE = 12;