From efdfd047fac06547a5a9173f25dea42aeef0a93f Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 11 Dec 2007 13:37:23 +0000 Subject: [PATCH] Set override_redirect attribute when fullscreen is requested Fix smooth control pairing capture_complete -> signal_capture_complete --- source/control.cpp | 6 ++++-- source/control.h | 2 +- source/glwindow.cpp | 3 ++- source/smoothcontrol.cpp | 7 ++++--- source/window.cpp | 10 ++++++++-- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/source/control.cpp b/source/control.cpp index 9b9223f..ef1170c 100644 --- a/source/control.cpp +++ b/source/control.cpp @@ -104,7 +104,7 @@ void Control::button_press(unsigned i) notify_callbacks(); capture_dev=0; connect_signals(); - capture_complete.emit(); + signal_capture_complete.emit(); } else if(src.type==BUTTON && i==src.index) on_press(); @@ -131,9 +131,11 @@ void Control::axis_motion(unsigned i, float v, float r) src.dev=capture_dev; src.type=type; src.index=i; + notify_callbacks(); + capture_dev=0; connect_signals(); - capture_complete.emit(); + signal_capture_complete.emit(); } } else if(src.type==AXIS_POS && i==src.index && v>=0) diff --git a/source/control.h b/source/control.h index 97e2be5..ccb16c5 100644 --- a/source/control.h +++ b/source/control.h @@ -50,7 +50,7 @@ or axis motion. class Control: public sigc::trackable { public: - sigc::signal capture_complete; + sigc::signal signal_capture_complete; protected: ControlSource src; diff --git a/source/glwindow.cpp b/source/glwindow.cpp index 303d542..fb585f0 100644 --- a/source/glwindow.cpp +++ b/source/glwindow.cpp @@ -103,8 +103,9 @@ void GLWindow::init() Colormap cmap=XCreateColormap(display, root, vi->visual, AllocNone); XSetWindowAttributes attr; attr.colormap=cmap; + attr.override_redirect=options.fullscreen; - Handle wnd=XCreateWindow(display, root, 0, 0, options.width, options.height, 0, vi->depth, InputOutput, vi->visual, CWColormap, &attr); + Handle wnd=XCreateWindow(display, root, 0, 0, options.width, options.height, 0, vi->depth, InputOutput, vi->visual, CWColormap|CWOverrideRedirect, &attr); set_window(wnd); glx_wnd=glXCreateWindow(display, config[0], wnd, 0); diff --git a/source/smoothcontrol.cpp b/source/smoothcontrol.cpp index 293e0b3..69dfacf 100644 --- a/source/smoothcontrol.cpp +++ b/source/smoothcontrol.cpp @@ -64,7 +64,8 @@ void SmoothControl::on_press() void SmoothControl::on_release() { - on_motion(0, -value); + if(value>0) + on_motion(0, -value); } void SmoothControl::on_motion(float v, float) @@ -72,8 +73,8 @@ void SmoothControl::on_motion(float v, float) value=v; signal_motion.emit(value); - if(paired_ctrl) - paired_ctrl->signal_motion.emit(-value); + if(paired_ctrl && paired_ctrl->get_value()!=-value) + paired_ctrl->on_motion(-value, -value-paired_ctrl->get_value()); } } // namespace Input diff --git a/source/window.cpp b/source/window.cpp index fb8ea33..ee5bec9 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -112,7 +112,7 @@ void Window::set_window(Handle wnd) { window=wnd; - XSelectInput(display, window, ButtonPressMask|ButtonReleaseMask|PointerMotionMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask); + XSelectInput(display, window, ButtonPressMask|ButtonReleaseMask|PointerMotionMask|KeyPressMask|KeyReleaseMask|StructureNotifyMask|EnterWindowMask); XSetWMProtocols(display, window, &wm_delete_window, 1); } @@ -121,7 +121,10 @@ void Window::init() { prepare(); - Handle wnd=XCreateWindow(display, DefaultRootWindow(display), 0, 0, options.width, options.height, 0, CopyFromParent, InputOutput, CopyFromParent, 0, 0); + XSetWindowAttributes attr; + attr.override_redirect=options.fullscreen; + + Handle wnd=XCreateWindow(display, DefaultRootWindow(display), 0, 0, options.width, options.height, 0, CopyFromParent, InputOutput, CopyFromParent, CWOverrideRedirect, &attr); set_window(wnd); } @@ -158,6 +161,9 @@ void Window::process_event(const XEvent &event) if(event.xclient.data.l[0]==static_cast(wm_delete_window)) signal_close.emit(); break; + case EnterNotify: + XSetInputFocus(display, window, RevertToParent, CurrentTime); + break; default:; } -- 2.45.2