Back to index

nux  3.0.0
XInputWindow.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2010 Inalogic® Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License, as
00006  * published by the  Free Software Foundation; either version 2.1 or 3.0
00007  * of the License.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranties of
00011  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00012  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00013  * License for more details.
00014  *
00015  * You should have received a copy of both the GNU Lesser General Public
00016  * License along with this program. If not, see <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Jay Taoko <jay.taoko_AT_gmail_DOT_com>
00019  *
00020  */
00021 
00022 #ifndef XINPUTWINDOW_H
00023 #define XINPUTWINDOW_H
00024 
00025 /* Xlib.h is the default header that is included and has the core functionallity */
00026 #include <X11/Xlib.h>
00027 /* Xatom.h includes functionallity for creating new protocol messages */
00028 #include <X11/Xatom.h>
00029 /* keysym.h contains keysymbols which we use to resolv what keys that are being pressed */
00030 #include <X11/keysym.h>
00031 #include <X11/Xregion.h>
00032 
00033 #include <X11/extensions/xf86vmode.h>
00034 
00035 #include "NuxCore/NuxCore.h"
00036 #include "NuxCore/Rect.h"
00037 
00038 namespace nux
00039 {
00040 
00041   class XInputWindow
00042   {
00043   public:
00044     XInputWindow(const char* title,
00045                  bool        take_focus = False,
00046                  int         override_redirect = 0);
00047     ~XInputWindow();
00048 
00049     static std::vector<Window> const& NativeHandleList();
00050 
00051     void EnableStruts(bool enable);
00052     bool StrutsEnabled();
00053 
00054     void EnableOverlayStruts(bool enable);
00055     bool OverlayStrutsEnabled();
00056 
00057     void EnsureInputs();
00058 
00059     void EnableTakeFocus ();
00060 
00062     void SetGeometry(const Rect& geo);
00063 
00065     void SetGeometry(int x, int y, int width, int height);
00066 
00068     Rect const& GetGeometry() const;
00069 
00071     Window GetWindow ();
00072 
00073     void SetInputFocus ();
00074 
00075     void Hide ();
00076     void Show ();
00077 
00078   private:
00079 
00080     std::vector<long int> GetStrutsData();
00081 
00082     void SetStruts ();
00083     void UnsetStruts ();
00084 
00085     void SetOverlayStruts ();
00086     void UnsetOverlayStruts ();
00087 
00088     void EnableDnd ();
00089     void DisableDnd ();
00090 
00091     static std::vector<Window> native_windows_;
00092 
00093     bool strutsEnabled_;
00094     bool overlayStrutsEnabled_;
00095     Window window_;
00096     Display *display_;
00097     Rect geometry_;
00098     bool shown_;
00099     bool mapped_;
00100     Atom overlay_strut_atom_;
00101   };
00102 }
00103 
00104 #endif // XINPUTWINDOW_H