diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d3d3b4da..a2555f2f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,7 @@ set(AWE_SRCS ${BUILD_DIR}/objects/drawin.c ${BUILD_DIR}/objects/key.c ${BUILD_DIR}/objects/screen.c + ${BUILD_DIR}/objects/selection_watcher.c ${BUILD_DIR}/objects/tag.c ${BUILD_DIR}/objects/window.c) diff --git a/event.c b/event.c index ddda3a6d4..6f23bd085 100644 --- a/event.c +++ b/event.c @@ -24,6 +24,7 @@ #include "property.h" #include "objects/tag.h" #include "objects/drawin.h" +#include "objects/selection_watcher.h" #include "xwindow.h" #include "ewmh.h" #include "objects/client.h" @@ -43,6 +44,7 @@ #include #include #include +#include #define DO_EVENT_HOOK_CALLBACK(type, xcbtype, xcbeventprefix, arraytype, match) \ static void \ @@ -1116,6 +1118,7 @@ void event_handle(xcb_generic_event_t *event) EXTENSION_EVENT(randr, XCB_RANDR_NOTIFY, event_handle_randr_output_change_notify); EXTENSION_EVENT(shape, XCB_SHAPE_NOTIFY, event_handle_shape_notify); EXTENSION_EVENT(xkb, 0, event_handle_xkb_notify); + EXTENSION_EVENT(xfixes, XCB_XFIXES_SELECTION_NOTIFY, event_handle_xfixes_selection_notify); #undef EXTENSION_EVENT } @@ -1134,6 +1137,10 @@ void event_init(void) reply = xcb_get_extension_data(globalconf.connection, &xcb_xkb_id); if (reply && reply->present) globalconf.event_base_xkb = reply->first_event; + + reply = xcb_get_extension_data(globalconf.connection, &xcb_xfixes_id); + if (reply && reply->present) + globalconf.event_base_xfixes = reply->first_event; } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/globalconf.h b/globalconf.h index 9224bd373..1001f9133 100644 --- a/globalconf.h +++ b/globalconf.h @@ -115,6 +115,7 @@ typedef struct uint8_t event_base_shape; uint8_t event_base_xkb; uint8_t event_base_randr; + uint8_t event_base_xfixes; /** Clients list */ client_array_t clients; /** Embedded windows */ diff --git a/luaa.c b/luaa.c index bfe8eee39..c26d3a319 100644 --- a/luaa.c +++ b/luaa.c @@ -49,6 +49,7 @@ #include "objects/drawable.h" #include "objects/drawin.h" #include "objects/screen.h" +#include "objects/selection_watcher.h" #include "objects/tag.h" #include "property.h" #include "selection.h" @@ -1035,6 +1036,9 @@ luaA_init(xdgHandle* xdg, string_array_t *searchpath) /* Export keys */ key_class_setup(L); + /* Export selection watcher */ + selection_watcher_class_setup(L); + /* add Lua search paths */ lua_getglobal(L, "package"); if (LUA_TTABLE != lua_type(L, 1)) diff --git a/objects/selection_watcher.c b/objects/selection_watcher.c new file mode 100644 index 000000000..360d5b9e6 --- /dev/null +++ b/objects/selection_watcher.c @@ -0,0 +1,34 @@ +/* + * selection_watcher.h - selection change watcher + * + * Copyright © 2019 Uli Schlachter + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include "objects/selection_watcher.h" + +void +event_handle_xfixes_selection_notify(xcb_generic_event_t *ev) +{ +} + +void +selection_watcher_class_setup(lua_State *L) +{ +} + +// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/objects/selection_watcher.h b/objects/selection_watcher.h new file mode 100644 index 000000000..cb7430765 --- /dev/null +++ b/objects/selection_watcher.h @@ -0,0 +1,33 @@ +/* + * selection_watcher.h - selection change watcher header + * + * Copyright © 2019 Uli Schlachter + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#ifndef AWESOME_OBJECTS_SELECTION_WATCHER_H +#define AWESOME_OBJECTS_SELECTION_WATCHER_H + +#include +#include + +void selection_watcher_class_setup(lua_State*); +void event_handle_xfixes_selection_notify(xcb_generic_event_t*); + +#endif + +// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80