summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-05-30 16:23:19 +0200
committerDave Davenport <qball@gmpclient.org>2017-05-30 16:23:19 +0200
commit9a6fd1c6c3d54c4a6db6ba7d15f317927f4036ec (patch)
treef87ad134ca304112591051fa9dee98a464080557
parent7aef96d391a166e9768e1ed58de72c4bbe3740ba (diff)
parent4e6af2eab84157794684c485d15fb9624ec0f306 (diff)
Merge in master
-rw-r--r--.gitmodules3
-rw-r--r--.travis.yml4
-rw-r--r--INSTALL.md2
-rw-r--r--Makefile.am15
-rw-r--r--configure.ac4
-rw-r--r--doc/test_xr.txt14
-rw-r--r--include/keyb.h59
-rw-r--r--include/theme.h12
-rw-r--r--include/view-internal.h9
-rw-r--r--include/view.h5
-rw-r--r--include/widgets/listview.h2
-rw-r--r--include/widgets/scrollbar.h2
-rw-r--r--include/widgets/textbox.h8
-rw-r--r--include/widgets/widget-internal.h69
-rw-r--r--include/widgets/widget.h116
-rw-r--r--include/x11-helper.h38
-rw-r--r--include/xkb-internal.h23
-rw-r--r--meson.build13
-rw-r--r--source/dialogs/ssh.c2
-rw-r--r--source/helper.c6
-rw-r--r--source/keyb.c290
-rw-r--r--source/rofi.c103
-rw-r--r--source/view.c203
-rw-r--r--source/widgets/box.c38
-rw-r--r--source/widgets/container.c30
-rw-r--r--source/widgets/listview.c115
-rw-r--r--source/widgets/scrollbar.c86
-rw-r--r--source/widgets/textbox.c31
-rw-r--r--source/widgets/widget.c59
-rw-r--r--source/x11-helper.c164
-rw-r--r--source/xrmoptions.c19
m---------subprojects/libnkutils0
-rw-r--r--test/box-test.c51
-rw-r--r--test/mode-test.c12
-rwxr-xr-xtest/run_issue333_test.sh2
-rwxr-xr-xtest/run_test.sh16
-rw-r--r--test/scrollbar-test.c25
-rw-r--r--test/theme-parser-test.c2
-rw-r--r--test/widget-test.c4
39 files changed, 785 insertions, 871 deletions
diff --git a/.gitmodules b/.gitmodules
index b0c4f823..33114f8b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "libgwater"]
path = subprojects/libgwater
url = git://github.com/sardemff7/libgwater
+[submodule "libnkutils"]
+ path = subprojects/libnkutils
+ url = https://github.com/sardemff7/libnkutils
diff --git a/.travis.yml b/.travis.yml
index 948d224b..62dcdcdf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,7 @@ addons:
- libpango1.0-dev
- libcairo2-dev
- libstartup-notification0-dev
+ - libxcb-ewmh-dev
- libxcb-icccm4-dev
- libxcb-util0-dev
- libxcb-xinerama0-dev
@@ -53,9 +54,8 @@ before_install:
# TODO: We install xkbcommon here, until Travis use an up-to-date enough Ubuntu
-# TODO: We install libxcb-ewmh-dev here, until it is whitelisted again in Travis
install:
- - sudo apt-get install -y --force-yes libxkbcommon-dev libxkbcommon-x11-dev libxcb-ewmh-dev flex/trusty-backports libfl-dev/trusty-backports
+ - sudo apt-get install -y --force-yes libxkbcommon-dev libxkbcommon-x11-dev flex/trusty-backports libfl-dev/trusty-backports
- pip3 install meson
- wget https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip
- unzip ninja-linux.zip
diff --git a/INSTALL.md b/INSTALL.md
index 3416723b..a0aa032c 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -28,7 +28,7 @@ Rofi uses autotools (GNU Build system), for more information see
* gmodule-2.0
* gio-unix-2.0
* libstartup-notification-1.0
-* libxkbcommon >= 0.5.0
+* libxkbcommon >= 0.4.1
* libxkbcommon-x11
* libxcb (sometimes split, you need libxcb, libxcb-xkb and libxcb-randr libxcb-xinerama)
* xcb-util
diff --git a/Makefile.am b/Makefile.am
index 50afdddf..8aaad607 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,15 @@
# Specify automake version.
AUTOMAKE_OPTIONS = 1.11.3
-ACLOCAL_AMFLAGS = -I subprojects/libgwater ${ACLOCAL_FLAGS}
+ACLOCAL_AMFLAGS = -I subprojects/libnkutils -I subprojects/libgwater ${ACLOCAL_FLAGS}
AM_YFLAGS = -d
noinst_LIBRARIES =
+EXTRA_DIST=
+check_PROGRAMS=
+TESTS=
+include $(top_srcdir)/subprojects/libnkutils/libnkutils-nolibtool.mk
include $(top_srcdir)/libgwater-xcb-nolibtool.mk
##
@@ -114,6 +118,7 @@ rofi_SOURCES=\
rofi_CFLAGS=\
$(AM_CFLAGS)\
$(glib_CFLAGS)\
+ $(NKUTILS_CFLAGS)\
$(GW_XCB_CFLAGS)\
$(pango_CFLAGS)\
$(libsn_CFLAGS)\
@@ -132,6 +137,7 @@ rofi_CFLAGS=\
rofi_LDADD=\
$(glib_LIBS)\
+ $(NKUTILS_LIBS)\
$(GW_XCB_LIBS)\
$(libsn_LIBS)\
$(pango_LIBS)\
@@ -197,7 +203,7 @@ theme_DATA=\
##
# Extra DIST
##
-EXTRA_DIST=\
+EXTRA_DIST+=\
$(markdown_FILES)\
$(markdown_SC_FILES)\
Examples/i3_switch_workspaces.sh\
@@ -219,7 +225,7 @@ update-manpage: $(top_srcdir)/doc/rofi-manpage.markdown $(top_srcdir)/doc/rofi-t
##
# Rofi test program
##
-check_PROGRAMS=\
+check_PROGRAMS+=\
history_test\
textbox_test\
helper_test\
@@ -488,7 +494,7 @@ mode_test_SOURCES=\
include/mode-private.h
endif
-TESTS=\
+TESTS+=\
history_test\
helper_test\
helper_expand\
@@ -560,6 +566,7 @@ coverage-clean:
EXTRA_DIST += \
doc/meson.build \
+ subprojects/libnkutils/meson.build \
subprojects/libgwater/xcb/meson.build \
meson_options.txt \
meson.build
diff --git a/configure.ac b/configure.ac
index 0445e422..8dc4fb8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,9 +116,9 @@ PKG_PROG_PKG_CONFIG
dnl ---------------------------------------------------------------------
dnl PKG_CONFIG based dependencies
dnl ---------------------------------------------------------------------
+NK_INIT([bindings])
PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40 gio-unix-2.0 gmodule-2.0])
-GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon >= 0.5.0 xkbcommon-x11 xcb-ewmh xcb-icccm xcb-xrm xcb-randr xcb-xinerama])
-PKG_CHECK_EXISTS([xkbcommon >= 0.7.0], [AC_DEFINE([XkBCOMMON_HAS_CONSUMED2], [1], [If xkbcommon has the consumed2 API])])
+GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon xkbcommon-x11 xcb-ewmh xcb-icccm xcb-xrm xcb-randr xcb-xinerama])
PKG_CHECK_MODULES([pango], [pango pangocairo])
PKG_CHECK_MODULES([cairo], [cairo cairo-xcb])
PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0 ])
diff --git a/doc/test_xr.txt b/doc/test_xr.txt
index 65a3bb21..53069cb0 100644
--- a/doc/test_xr.txt
+++ b/doc/test_xr.txt
@@ -216,3 +216,17 @@ rofi.kb-custom-19: Alt+parenleft
! rofi.kb-select-9: Super+9
! "Select row 10" Set from: Default
! rofi.kb-select-10: Super+0
+! "Go to the previous column" Set from: Default
+! rofi.ml-row-left: Mouse6
+! "Go to the next column" Set from: Default
+! rofi.ml-row-right: Mouse7
+! "Select previous entry" Set from: Default
+! rofi.ml-row-up: Mouse4
+! "Select next entry" Set from: Default
+! rofi.ml-row-down: Mouse5
+! "Select hovered row" Set from: Default
+! rofi.me-select-entry: Mouse1
+! "Accept hovered row" Set from: Default
+! rofi.me-accept-entry: MouseD1
+! "Accept hovered row with custom action" Set from: Default
+! rofi.me-accept-custom: Control+MouseD1
diff --git a/include/keyb.h b/include/keyb.h
index 37263a34..e33b00b0 100644
--- a/include/keyb.h
+++ b/include/keyb.h
@@ -28,19 +28,34 @@
#ifndef ROFI_KEYB_H
#define ROFI_KEYB_H
+#include "nkutils-bindings.h"
+
/**
* @defgroup KEYB KeyboardBindings
*
* @{
*/
+typedef enum
+{
+ SCOPE_GLOBAL,
+ SCOPE_MOUSE_LISTVIEW,
+ SCOPE_MOUSE_LISTVIEW_ELEMENT,
+
+#define SCOPE_MIN_FIXED SCOPE_MOUSE_EDITBOX
+ SCOPE_MOUSE_EDITBOX,
+ SCOPE_MOUSE_SCROLLBAR,
+ SCOPE_MOUSE_SIDEBAR_MODI,
+#define SCOPE_MAX_FIXED SCOPE_MOUSE_SIDEBAR_MODI
+} BindingsScope;
+
/**
* List of all possible actions that can be triggered by a keybinding.
*/
typedef enum
{
/** Paste from primary clipboard */
- PASTE_PRIMARY = 0,
+ PASTE_PRIMARY = 1,
/** Paste from secondary clipboard */
PASTE_SECONDARY,
/** Clear the entry box. */
@@ -119,14 +134,36 @@ typedef enum
SELECT_ELEMENT_8,
SELECT_ELEMENT_9,
SELECT_ELEMENT_10,
- NUM_ABE
} KeyBindingAction;
+typedef enum
+{
+ SCROLL_LEFT = 1,
+ SCROLL_RIGHT,
+ SCROLL_DOWN,
+ SCROLL_UP,
+} MouseBindingListviewAction;
+
+typedef enum
+{
+ SELECT_HOVERED_ENTRY = 1,
+ ACCEPT_HOVERED_ENTRY,
+ ACCEPT_HOVERED_CUSTOM,
+} MouseBindingListviewElementAction;
+
+typedef enum
+{
+ MOUSE_CLICK_DOWN = 1,
+ MOUSE_CLICK_UP,
+ MOUSE_DCLICK_DOWN,
+ MOUSE_DCLICK_UP,
+} MouseBindingMouseDefaultAction;
+
/**
* Parse the keybindings.
* This should be called after the setting system is initialized.
*/
-gboolean parse_keys_abe ( void );
+gboolean parse_keys_abe ( NkBindings *bindings );
/**
* Setup the keybindings
@@ -134,21 +171,5 @@ gboolean parse_keys_abe ( void );
*/
void setup_abe ( void );
-/**
- * Cleanup.
- */
-void cleanup_abe ( void );
-
-/**
- * Find if a binding has been triggered.
- * @returns NUM_ABE if no key combo matches, a valid action otherwise.
- */
-KeyBindingAction abe_find_action ( unsigned int mask, xkb_keysym_t key );
-
-/**
- * Trigger keybinding on key release.
- */
-void abe_trigger_release ( void );
-
/*@}*/
#endif // ROFI_KEYB_H
diff --git a/include/theme.h b/include/theme.h
index bc200953..bfb628b0 100644
--- a/include/theme.h
+++ b/include/theme.h
@@ -37,19 +37,19 @@
typedef enum
{
/** no highlight */
- HL_NONE = 0,
+ HL_NONE = 0,
/** bold */
- HL_BOLD = 1,
+ HL_BOLD = 1,
/** underline */
- HL_UNDERLINE = 2,
+ HL_UNDERLINE = 2,
/** strikethrough */
HL_STRIKETHROUGH = 16,
/** small caps */
- HL_SMALL_CAPS = 32,
+ HL_SMALL_CAPS = 32,
/** italic */
- HL_ITALIC = 4,
+ HL_ITALIC = 4,
/** color */
- HL_COLOR = 8
+ HL_COLOR = 8
} HighlightStyle;
/** Style of line */
diff --git a/include/view-internal.h b/include/view-internal.h
index 1dd8ebfb..488e7912 100644
--- a/include/view-internal.h
+++ b/include/view-internal.h
@@ -118,8 +118,15 @@ struct RofiViewState
/** Y position of the view */
int y;
+ struct
+ {
+ int x;
+ int y;
+ widget *motion_target;
+ } mouse;
+
/** Regexs used for matching */
- GRegex **tokens;
+ GRegex **tokens;
};
/** @} */
#endif
diff --git a/include/view.h b/include/view.h
index cb5d45d1..6dd82230 100644
--- a/include/view.h
+++ b/include/view.h
@@ -139,11 +139,12 @@ void rofi_view_restart ( RofiViewState *state );
/**
* @param state The handle to the view
- * @param action The keyboard action
+ * @param scope The scope of the action
+ * @param action The action
*
* @returns TRUE if action was handled.
*/
-gboolean rofi_view_trigger_action ( RofiViewState *state, KeyBindingAction action );
+gboolean rofi_view_trigger_action ( RofiViewState *state, BindingsScope scope, guint action );
/**
* @param state The handle to the view
diff --git a/include/widgets/listview.h b/include/widgets/listview.h
index 4373cc6b..81d705b1 100644
--- a/include/widgets/listview.h
+++ b/include/widgets/listview.h
@@ -66,7 +66,7 @@ typedef void ( *listview_update_callback )( textbox *tb, unsigned int entry, voi
/**
* Callback when a element is activated.
*/
-typedef void ( *listview_mouse_activated_cb )( listview *, xcb_button_press_event_t *, void * );
+typedef void ( *listview_mouse_activated_cb )( listview *, gboolean, void * );
/**
* @param name The name of the to be created widget.
diff --git a/include/widgets/scrollbar.h b/include/widgets/scrollbar.h
index 75ecfbf9..7bf97cc1 100644
--- a/include/widgets/scrollbar.h
+++ b/include/widgets/scrollbar.h
@@ -88,7 +88,7 @@ void scrollbar_set_max_value ( scrollbar *sb, unsigned int max );
*
* Calculate the position of the click relative to the max value of bar
*/
-unsigned int scrollbar_clicked ( const scrollbar *sb, int y );
+guint scrollbar_scroll_get_line ( const scrollbar *sb, int y );
/*@}*/
#endif // ROFI_SCROLLBAR_H
diff --git a/include/widgets/textbox.h b/include/widgets/textbox.h
index 8b4c5386..904882bd 100644
--- a/include/widgets/textbox.h
+++ b/include/widgets/textbox.h
@@ -112,6 +112,7 @@ typedef enum
} TextBoxFontType;
/**
+ * @param type The type of the to be created widget.
* @param name The name of the to be created widget.
* @param flags #TextboxFlags indicating the type of textbox.
* @param tbft #TextBoxFontType current state of textbox.
@@ -122,9 +123,10 @@ typedef enum
* free with #widget_free
* @returns a new #textbox
*/
-textbox* textbox_create ( const char *name, TextboxFlags flags,
- TextBoxFontType tbft,
- const char *text );
+textbox* textbox_create_full ( WidgetType type, const char *name, TextboxFlags flags,
+ TextBoxFontType tbft,
+ const char *text );
+#define textbox_create( n, f, tbft, t ) textbox_create_full ( WIDGET_TYPE_UNKNOWN, n, f, tbft, t )
/**
* @param tb Handle to the textbox
* @param tbft The style of font to render.
diff --git a/include/widgets/widget-internal.h b/include/widgets/widget-internal.h
index 762c4794..7a1ab627 100644
--- a/include/widgets/widget-internal.h
+++ b/include/widgets/widget-internal.h
@@ -34,74 +34,79 @@
*/
struct _widget
{
+ /** The type of the widget */
+ WidgetType type;
/** X position relative to parent */
- short x;
+ short x;
/** Y position relative to parent */
- short y;
+ short y;
/** Width of the widget */
- short w;
+ short w;
/** Height of the widget */
- short h;
+ short h;
/** Padding */
- Padding def_margin;
- Padding def_padding;
- Padding def_border;
- Padding def_border_radius;
- Padding margin;
- Padding padding;
- Padding border;
- Padding border_radius;
+ Padding def_margin;
+ Padding def_padding;
+ Padding def_border;
+ Padding def_border_radius;
+ Padding margin;
+ Padding padding;
+ Padding border;
+ Padding border_radius;
/** enabled or not */
- gboolean enabled;
+ gboolean enabled;
/** Expand the widget when packed */
- gboolean expand;
+ gboolean expand;
/*** The packing index */
- int index;
+ int index;
/** Place widget at end of parent */
- gboolean end;
+ gboolean end;
/** Parent widget */
- struct _widget *parent;
+ struct _widget *parent;
/** Internal */
- gboolean need_redraw;
+ gboolean need_redraw;
/** get width of widget implementation function */
- int ( *get_width )( struct _widget * );
+ int ( *get_width )( struct _widget * );
/** get height of widget implementation function */
- int ( *get_height )( struct _widget * );
+ int ( *get_height )( struct _widget * );
/** draw widget implementation function */
- void ( *draw )( struct _widget *widget, cairo_t *draw );
+ void ( *draw )( struct _widget *widget, cairo_t *draw );
/** resize widget implementation function */
- void ( *resize )( struct _widget *, short, short );
+ void ( *resize )( struct _widget *, short, short );
/** update widget implementation function */
- void ( *update )( struct _widget * );
+ void ( *update )( struct _widget * );
/** Handle mouse motion, used for dragging */
- gboolean ( *motion_notify )( struct _widget *, xcb_motion_notify_event_t * );
+ gboolean ( *motion_notify )( struct _widget *, gint x, gint y );
int ( *get_desired_height )( struct _widget * );
int ( *get_desired_width )( struct _widget * );
- /** widget clicked callback */
- widget_clicked_cb clicked;
- /** user data for clicked callback */
- void *clicked_cb_data;
+ /** widget find_mouse_target callback */
+ widget_find_mouse_target_cb find_mouse_target;
+ /** widget trigger_action callback */
+ widget_trigger_action_cb trigger_action;
+ /** user data for find_mouse_target and trigger_action callback */
+ void *trigger_action_cb_data;
/** Free widget callback */
- void ( *free )( struct _widget *widget );
+ void ( *free )( struct _widget *widget );
/** Name of widget (used for theming) */
- char *name;
- const char *state;
+ char *name;
+ const char *state;
};
/**
* @param widget The widget to initialize.
+ * @param type The type of the widget.
* @param name The name of the widget.
*
* Initializes the widget structure.
*
*/
-void widget_init ( widget *widget, const char *name );
+void widget_init ( widget *widget, WidgetType type, const char *name );
/**
* @param widget The widget handle.
diff --git a/include/widgets/widget.h b/include/widgets/widget.h
index 36eecf90..8fce3a43 100644
--- a/include/widgets/widget.h
+++ b/include/widgets/widget.h
@@ -31,6 +31,7 @@
#include <cairo.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
+#include "keyb.h"
/**
* @defgroup widget widget
*
@@ -50,9 +51,63 @@
typedef struct _widget widget;
/**
- * Callback for when widget is clicked.
+ * Type of the widget. It is used to bubble events to the relevant widget.
*/
-typedef gboolean ( *widget_clicked_cb )( widget *, xcb_button_press_event_t *, void * );
+typedef enum
+{
+ /** Default type */
+ WIDGET_TYPE_UNKNOWN,
+ /** The listview widget */
+ WIDGET_TYPE_LISTVIEW = SCOPE_MOUSE_LISTVIEW,
+ /** An element in the listview */
+ WIDGET_TYPE_LISTVIEW_ELEMENT = SCOPE_MOUSE_LISTVIEW_ELEMENT,
+ /** The input bar edit box */
+ WIDGET_TYPE_EDITBOX = SCOPE_MOUSE_EDITBOX,
+ /** The listview scrollbar */
+ WIDGET_TYPE_SCROLLBAR = SCOPE_MOUSE_SCROLLBAR,
+ /** A tab in the modi sidebar */
+ WIDGET_TYPE_SIDEBAR_MODI = SCOPE_MOUSE_SIDEBAR_MODI,
+} WidgetType;
+
+/**
+ * Whether and how the action was handled
+ */
+typedef enum
+{
+ /** The action was ignore and should bubble */
+ WIDGET_TRIGGER_ACTION_RESULT_IGNORED,
+ /** The action was handled directly */
+ WIDGET_TRIGGER_ACTION_RESULT_HANDLED,
+ /** The action was handled and should start the grab for motion events */
+ WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN,
+ /** The action was handled and should stop the grab for motion events */
+ WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END,
+} WidgetTriggerActionResult;
+
+/**
+ * @param widget The container widget itself
+ * @param type The widget type searched for
+ * @param x The X coordination of the mouse event relative to @param widget
+ * @param y The Y coordination of the mouse event relative to @param widget
+ *
+ * This callback must only iterate over the children of a Widget, and return NULL if none of them is relevant.
+ *
+ * @returns A child widget if found, NULL otherwise
+ */
+typedef widget * ( *widget_find_mouse_target_cb )( widget *widget, WidgetType type, gint x, gint y );
+
+/**
+ * @param widget The target widget
+ * @param action The action value (which enum it is depends on the widget type)
+ * @param x The X coordination of the mouse event relative to @param widget
+ * @param y The Y coordination of the mouse event relative to @param widget
+ * @param user_data The data passed to widget_set_trigger_action_handler()
+ *
+ * This callback should handle the action if relevant, and returns whether it did or not.
+ *
+ * @returns Whether the action was handled or not, see enum values for details
+ */
+typedef WidgetTriggerActionResult ( *widget_trigger_action_cb )( widget *widget, guint action, gint x, gint y, void *user_data );
/** Macro to get widget from an implementation (e.g. textbox/scrollbar) */
#define WIDGET( a ) ( (widget *) ( a ) )
@@ -80,6 +135,14 @@ void widget_move ( widget *widget, short x, short y );
/**
* @param widget Handle to widget
*
+ * Get the type of the widget.
+ * @returns The type of the widget.
+ */
+WidgetType widget_type ( widget *widget );
+
+/**
+ * @param widget Handle to widget
+ *
* Check if widget is enabled.
* @returns TRUE when widget is enabled.
*/
@@ -151,6 +214,15 @@ int widget_get_x_pos ( widget *widget );
/**
* @param widget The widget handle
+ * @param x A pointer to the absolute X coordinates
+ * @param y A pointer to the absolute Y coordinates
+ *
+ * Will modify @param x and @param y to make them relative to @param widget .
+ */
+void widget_xy_to_relative ( widget *widget, gint *x, gint *y );
+
+/**
+ * @param widget The widget handle
*
* Update the widget, and its parent recursively.
* This should be called when size of widget changes.
@@ -172,34 +244,48 @@ gboolean widget_need_redraw ( widget *wid );
/**
* @param wid The widget handle
- * @param xbe The button press event
+ * @param type The type of the wanted widget
+ * @param x The x coordinate of the mouse event
+ * @param y The y coordinate of the mouse event
*
- * Signal the widget that it has been clicked,
- * The click should have happened within the region of the widget, check with
- * ::widget_intersect.
+ * Get the widget that should handle a mouse event.
*
- * @returns returns TRUE if click is handled.
+ * @returns returns the widget that should handle the mouse event.
*/
-gboolean widget_clicked ( widget *wid, xcb_button_press_event_t *xbe );
+widget *widget_find_mouse_target ( widget *wid, WidgetType type, gint x, gint y );
/**
* @param wid The widget handle
- * @param cb The widget click callback
+ * @param action The action to trigger
+ * @param x A pointer to the x coordinate of the click
+ * @param y A pointer to the y coordinate of the click
+ *
+ * Trigger an action on widget.
+ * @param x and @param y are relative to @param wid .
+ *
+ * @returns Whether the action was handled or not
+ */
+WidgetTriggerActionResult widget_trigger_action ( widget *wid, guint action, gint x, gint y );
+
+/**
+ * @param wid The widget handle
+ * @param cb The widget trigger action callback
* @param udata the user data to pass to callback
*
- * Override the widget clicked handler on widget.
+ * Override the widget trigger action handler on widget.
*/
-void widget_set_clicked_handler ( widget *wid, widget_clicked_cb cb, void *udata );
+void widget_set_trigger_action_handler ( widget *wid, widget_trigger_action_cb cb, void *udata );
/**
* @param wid The widget handle
- * @param xme The motion notify object.
+ * @param x The x coordinate of the mouse event
+ * @param y The y coordinate of the mouse event
*
* Motion notify.
- * TODO make this like clicked with callback.
- * returns TRUE when handled.
+ *
+ * @returns TRUE when handled.
*/
-gboolean widget_motion_notify ( widget *wid, xcb_motion_notify_event_t *xme );
+gboolean widget_motion_notify ( widget *wid, gint x, gint y );
/**
* @param wid The widget handle
diff --git a/include/x11-helper.h b/include/x11-helper.h
index 68ebde32..01b061e6 100644
--- a/include/x11-helper.h
+++ b/include/x11-helper.h
@@ -171,38 +171,12 @@ int take_keyboard ( xcb_window_t w, int iters );
int take_pointer ( xcb_window_t w, int iters );
/**
- * @param mask The mask to canonilize
- *
- * @return The canonilized mask
- */
-unsigned int x11_canonalize_mask ( unsigned int mask );
-
-/**
- * @param xkb the xkb structure.
- *
- * Calculates the mask of all active modifier keys.
- *
- * @returns the mask describing all active modifier keys.
- */
-unsigned int x11_get_current_mask ( xkb_stuff *xkb );
-
-/**
- * @param combo String representing the key combo
- * @param mod [out] The modifier specified (or AnyModifier if not specified)
- * @param key [out] The key specified