Port Workspace's null focus window to xcb
Adding wrappers to Xcb::Window for setInputFocus. REVIEW: 110246
This commit is contained in:
parent
23b395059f
commit
2320b71cb7
3 changed files with 23 additions and 8 deletions
|
@ -240,11 +240,9 @@ void Workspace::init()
|
||||||
supportWindow = new QWidget(NULL, Qt::X11BypassWindowManagerHint);
|
supportWindow = new QWidget(NULL, Qt::X11BypassWindowManagerHint);
|
||||||
XLowerWindow(display(), supportWindow->winId()); // See usage in layers.cpp
|
XLowerWindow(display(), supportWindow->winId()); // See usage in layers.cpp
|
||||||
|
|
||||||
XSetWindowAttributes attr;
|
const uint32_t nullFocusValues[] = {true};
|
||||||
attr.override_redirect = 1;
|
m_nullFocus.reset(new Xcb::Window(QRect(-1, -1, 1, 1), XCB_WINDOW_CLASS_INPUT_ONLY, XCB_CW_OVERRIDE_REDIRECT, nullFocusValues));
|
||||||
null_focus_window = XCreateWindow(display(), rootWindow(), -1, -1, 1, 1, 0, CopyFromParent,
|
m_nullFocus->map();
|
||||||
InputOnly, CopyFromParent, CWOverrideRedirect, &attr);
|
|
||||||
XMapWindow(display(), null_focus_window);
|
|
||||||
|
|
||||||
unsigned long protocols[5] = {
|
unsigned long protocols[5] = {
|
||||||
NET::Supported |
|
NET::Supported |
|
||||||
|
@ -511,7 +509,6 @@ Workspace::~Workspace()
|
||||||
delete client_keys_dialog;
|
delete client_keys_dialog;
|
||||||
foreach (SessionInfo * s, session)
|
foreach (SessionInfo * s, session)
|
||||||
delete s;
|
delete s;
|
||||||
XDestroyWindow(display(), null_focus_window);
|
|
||||||
|
|
||||||
// TODO: ungrabXServer();
|
// TODO: ungrabXServer();
|
||||||
|
|
||||||
|
@ -1378,7 +1375,7 @@ bool Workspace::checkStartupNotification(xcb_window_t w, KStartupInfoId &id, KSt
|
||||||
*/
|
*/
|
||||||
void Workspace::focusToNull()
|
void Workspace::focusToNull()
|
||||||
{
|
{
|
||||||
XSetInputFocus(display(), null_focus_window, RevertToPointerRoot, xTime());
|
m_nullFocus->focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::setShowingDesktop(bool showing)
|
void Workspace::setShowingDesktop(bool showing)
|
||||||
|
|
|
@ -46,6 +46,11 @@ class KStartupInfoData;
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
namespace Xcb
|
||||||
|
{
|
||||||
|
class Window;
|
||||||
|
}
|
||||||
|
|
||||||
class Client;
|
class Client;
|
||||||
class KillWindow;
|
class KillWindow;
|
||||||
class RootInfo;
|
class RootInfo;
|
||||||
|
@ -556,7 +561,7 @@ private:
|
||||||
int set_active_client_recursion;
|
int set_active_client_recursion;
|
||||||
int block_stacking_updates; // When > 0, stacking updates are temporarily disabled
|
int block_stacking_updates; // When > 0, stacking updates are temporarily disabled
|
||||||
bool blocked_propagating_new_clients; // Propagate also new clients after enabling stacking updates?
|
bool blocked_propagating_new_clients; // Propagate also new clients after enabling stacking updates?
|
||||||
Window null_focus_window;
|
QScopedPointer<Xcb::Window> m_nullFocus;
|
||||||
bool forced_global_mouse_grab;
|
bool forced_global_mouse_grab;
|
||||||
friend class StackingUpdatesBlocker;
|
friend class StackingUpdatesBlocker;
|
||||||
|
|
||||||
|
|
13
xcbutils.h
13
xcbutils.h
|
@ -38,6 +38,7 @@ typedef xcb_window_t WindowId;
|
||||||
|
|
||||||
// forward declaration of methods
|
// forward declaration of methods
|
||||||
static void defineCursor(xcb_window_t window, xcb_cursor_t cursor);
|
static void defineCursor(xcb_window_t window, xcb_cursor_t cursor);
|
||||||
|
static void setInputFocus(xcb_window_t window, uint8_t revertTo = XCB_INPUT_FOCUS_POINTER_ROOT, xcb_timestamp_t time = xTime());
|
||||||
|
|
||||||
template <typename Reply,
|
template <typename Reply,
|
||||||
typename Cookie,
|
typename Cookie,
|
||||||
|
@ -355,6 +356,7 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
void setBackgroundPixmap(xcb_pixmap_t pixmap);
|
void setBackgroundPixmap(xcb_pixmap_t pixmap);
|
||||||
void defineCursor(xcb_cursor_t cursor);
|
void defineCursor(xcb_cursor_t cursor);
|
||||||
|
void focus(uint8_t revertTo = XCB_INPUT_FOCUS_POINTER_ROOT, xcb_timestamp_t time = xTime());
|
||||||
operator xcb_window_t() const;
|
operator xcb_window_t() const;
|
||||||
private:
|
private:
|
||||||
Window(const Window &other);
|
Window(const Window &other);
|
||||||
|
@ -533,6 +535,12 @@ void Window::defineCursor(xcb_cursor_t cursor)
|
||||||
Xcb::defineCursor(m_window, cursor);
|
Xcb::defineCursor(m_window, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
void Window::focus(uint8_t revertTo, xcb_timestamp_t time)
|
||||||
|
{
|
||||||
|
setInputFocus(m_window, revertTo, time);
|
||||||
|
}
|
||||||
|
|
||||||
// helper functions
|
// helper functions
|
||||||
static inline void moveResizeWindow(WindowId window, const QRect &geometry)
|
static inline void moveResizeWindow(WindowId window, const QRect &geometry)
|
||||||
{
|
{
|
||||||
|
@ -625,6 +633,11 @@ static inline void defineCursor(xcb_window_t window, xcb_cursor_t cursor)
|
||||||
xcb_change_window_attributes(connection(), window, XCB_CW_CURSOR, &cursor);
|
xcb_change_window_attributes(connection(), window, XCB_CW_CURSOR, &cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void setInputFocus(xcb_window_t window, uint8_t revertTo, xcb_timestamp_t time)
|
||||||
|
{
|
||||||
|
xcb_set_input_focus(connection(), revertTo, window, time);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace X11
|
} // namespace X11
|
||||||
|
|
||||||
} // namespace KWin
|
} // namespace KWin
|
||||||
|
|
Loading…
Reference in a new issue