]> git.tdb.fi Git - libs/gui.git/commitdiff
Set override_redirect attribute when fullscreen is requested
authorMikko Rasa <tdb@tdb.fi>
Tue, 11 Dec 2007 13:37:23 +0000 (13:37 +0000)
committerMikko Rasa <tdb@tdb.fi>
Tue, 11 Dec 2007 13:37:23 +0000 (13:37 +0000)
Fix smooth control pairing
capture_complete -> signal_capture_complete

source/control.cpp
source/control.h
source/glwindow.cpp
source/smoothcontrol.cpp
source/window.cpp

index 9b9223fd9a5105d7854f0b81a45e7ee7133a3198..ef1170cc84b66b42bb8ac0659e97adf1a8f978b6 100644 (file)
@@ -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)
index 97e2be5b0259806d6e3681ea781acb82857242a7..ccb16c51cabf42b70063cea68983159f8fed63c5 100644 (file)
@@ -50,7 +50,7 @@ or axis motion.
 class Control: public sigc::trackable
 {
 public:
-       sigc::signal<void> capture_complete;
+       sigc::signal<void> signal_capture_complete;
 
 protected:
        ControlSource src;
index 303d542a28585ae2574b896ca6ea39fe38db1956..fb585f0c19b69a68c8e82aed392a3ab8de6ea887 100644 (file)
@@ -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);
index 293e0b3dcba7bf985dfe59904ad5fb7ae01682c3..69dfacf955049f38000f170cd45e8aa91ddaefe0 100644 (file)
@@ -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
index fb8ea332ad4346aad712aee34ad0e1eb2a8ceed9..ee5bec90d93f6165c742e13316fca7d621d79d10 100644 (file)
@@ -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<long>(wm_delete_window))
                        signal_close.emit();
                break;
+       case EnterNotify:
+               XSetInputFocus(display, window, RevertToParent, CurrentTime);
+               break;
        default:;
        }