Prepare a selection watcher interface

This commit adds the necessary method calls to setup the class and also
so that xfixes selection notify events can be handled. Currently, these
are empty functions, but later commits will fill them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2019-02-06 09:30:16 +01:00
parent 2023ed187a
commit 0295df81c1
6 changed files with 80 additions and 0 deletions

View File

@ -88,6 +88,7 @@ set(AWE_SRCS
${BUILD_DIR}/objects/drawin.c ${BUILD_DIR}/objects/drawin.c
${BUILD_DIR}/objects/key.c ${BUILD_DIR}/objects/key.c
${BUILD_DIR}/objects/screen.c ${BUILD_DIR}/objects/screen.c
${BUILD_DIR}/objects/selection_watcher.c
${BUILD_DIR}/objects/tag.c ${BUILD_DIR}/objects/tag.c
${BUILD_DIR}/objects/window.c) ${BUILD_DIR}/objects/window.c)

View File

@ -24,6 +24,7 @@
#include "property.h" #include "property.h"
#include "objects/tag.h" #include "objects/tag.h"
#include "objects/drawin.h" #include "objects/drawin.h"
#include "objects/selection_watcher.h"
#include "xwindow.h" #include "xwindow.h"
#include "ewmh.h" #include "ewmh.h"
#include "objects/client.h" #include "objects/client.h"
@ -43,6 +44,7 @@
#include <xcb/xcb_icccm.h> #include <xcb/xcb_icccm.h>
#include <xcb/xcb_event.h> #include <xcb/xcb_event.h>
#include <xcb/xkb.h> #include <xcb/xkb.h>
#include <xcb/xfixes.h>
#define DO_EVENT_HOOK_CALLBACK(type, xcbtype, xcbeventprefix, arraytype, match) \ #define DO_EVENT_HOOK_CALLBACK(type, xcbtype, xcbeventprefix, arraytype, match) \
static void \ 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(randr, XCB_RANDR_NOTIFY, event_handle_randr_output_change_notify);
EXTENSION_EVENT(shape, XCB_SHAPE_NOTIFY, event_handle_shape_notify); EXTENSION_EVENT(shape, XCB_SHAPE_NOTIFY, event_handle_shape_notify);
EXTENSION_EVENT(xkb, 0, event_handle_xkb_notify); EXTENSION_EVENT(xkb, 0, event_handle_xkb_notify);
EXTENSION_EVENT(xfixes, XCB_XFIXES_SELECTION_NOTIFY, event_handle_xfixes_selection_notify);
#undef EXTENSION_EVENT #undef EXTENSION_EVENT
} }
@ -1134,6 +1137,10 @@ void event_init(void)
reply = xcb_get_extension_data(globalconf.connection, &xcb_xkb_id); reply = xcb_get_extension_data(globalconf.connection, &xcb_xkb_id);
if (reply && reply->present) if (reply && reply->present)
globalconf.event_base_xkb = reply->first_event; 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 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -115,6 +115,7 @@ typedef struct
uint8_t event_base_shape; uint8_t event_base_shape;
uint8_t event_base_xkb; uint8_t event_base_xkb;
uint8_t event_base_randr; uint8_t event_base_randr;
uint8_t event_base_xfixes;
/** Clients list */ /** Clients list */
client_array_t clients; client_array_t clients;
/** Embedded windows */ /** Embedded windows */

4
luaa.c
View File

@ -49,6 +49,7 @@
#include "objects/drawable.h" #include "objects/drawable.h"
#include "objects/drawin.h" #include "objects/drawin.h"
#include "objects/screen.h" #include "objects/screen.h"
#include "objects/selection_watcher.h"
#include "objects/tag.h" #include "objects/tag.h"
#include "property.h" #include "property.h"
#include "selection.h" #include "selection.h"
@ -1035,6 +1036,9 @@ luaA_init(xdgHandle* xdg, string_array_t *searchpath)
/* Export keys */ /* Export keys */
key_class_setup(L); key_class_setup(L);
/* Export selection watcher */
selection_watcher_class_setup(L);
/* add Lua search paths */ /* add Lua search paths */
lua_getglobal(L, "package"); lua_getglobal(L, "package");
if (LUA_TTABLE != lua_type(L, 1)) if (LUA_TTABLE != lua_type(L, 1))

View File

@ -0,0 +1,34 @@
/*
* selection_watcher.h - selection change watcher
*
* Copyright © 2019 Uli Schlachter <psychon@znc.in>
*
* 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

View File

@ -0,0 +1,33 @@
/*
* selection_watcher.h - selection change watcher header
*
* Copyright © 2019 Uli Schlachter <psychon@znc.in>
*
* 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 <lua.h>
#include <xcb/xcb.h>
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