1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-04-14 17:43:01 -04:00

Ctrl-click does alternate accept entry.

Fixes #429
This commit is contained in:
Dave Davenport 2016-09-02 18:19:16 +02:00
parent b420db8d30
commit 4379f3be7c
3 changed files with 24 additions and 13 deletions

View file

@ -46,6 +46,18 @@ enum { EWMH_ATOMS ( ATOM_ENUM ), NUM_NETATOMS };
extern const char *netatom_names[];
extern xcb_atom_t netatoms[NUM_NETATOMS];
enum
{
X11MOD_SHIFT,
X11MOD_CONTROL,
X11MOD_ALT,
X11MOD_META,
X11MOD_SUPER,
X11MOD_HYPER,
X11MOD_ANY,
NUM_X11MOD
};
typedef struct _workarea
{
int monitor_id;
@ -155,5 +167,6 @@ cairo_surface_t * x11_helper_get_bg_surface ( void );
*/
void x11_build_monitor_layout ( void );
void x11_dump_monitor_layout ( void );
int x11_modifier_active ( unsigned int mask, int key );
/*@}*/
#endif

View file

@ -1199,6 +1199,7 @@ static void rofi_view_mouse_navigation ( RofiViewState *state, xcb_button_press_
}
for ( unsigned int i = 0; i < state->max_elements; i++ ) {
if ( widget_intersect ( &( state->boxes[i]->widget ), xbe->event_x, xbe->event_y ) ) {
int control = x11_modifier_active ( xbe->state, X11MOD_CONTROL);
// Only allow items that are visible to be selected.
if ( ( state->last_offset + i ) >= state->filtered_lines ) {
break;
@ -1206,8 +1207,11 @@ static void rofi_view_mouse_navigation ( RofiViewState *state, xcb_button_press_
//
state->selected = state->last_offset + i;
state->update = TRUE;
if ( ( xbe->time - state->last_button_press ) < 200 ) {
state->retv = MENU_OK;
if ( ( xbe->time - state->last_button_press ) < 200 || control ) {
state->retv = MENU_OK;
if ( control ) {
state->retv |= MENU_CUSTOM_ACTION;
}
( state->selected_line ) = state->line_map[state->selected];
// Quit
state->quit = TRUE;

View file

@ -68,17 +68,6 @@ struct _xcb_stuff xcb_int = {
};
xcb_stuff *xcb = &xcb_int;
enum
{
X11MOD_SHIFT,
X11MOD_CONTROL,
X11MOD_ALT,
X11MOD_META,
X11MOD_SUPER,
X11MOD_HYPER,
X11MOD_ANY,
NUM_X11MOD
};
xcb_depth_t *depth = NULL;
xcb_visualtype_t *visual = NULL;
@ -598,6 +587,11 @@ static void x11_figure_out_masks ( xkb_stuff *xkb )
}
}
int x11_modifier_active ( unsigned int mask, int key )
{
return (x11_mod_masks[key]&mask) != 0;
}
unsigned int x11_canonalize_mask ( unsigned int mask )
{
// Bits 13 and 14 of the modifiers together are the group number, and