add back/forward mouse button processing to GTK frontend

This commit is contained in:
Vincent Sanders 2021-01-02 09:49:25 +00:00
parent 434f6c3fe7
commit 25c21e5fef
2 changed files with 16 additions and 2 deletions

View File

@ -87,6 +87,7 @@ static browser_mouse_state nsgtk_cw_gdkbutton_to_nsstate(GdkEventButton *event)
}
if (event->state & GDK_MOD1_MASK) {
/* usually alt */
ms |= BROWSER_MOUSE_MOD_3;
}

View File

@ -391,12 +391,25 @@ nsgtk_window_button_release_event(GtkWidget *widget,
bool shift = event->state & GDK_SHIFT_MASK;
bool ctrl = event->state & GDK_CONTROL_MASK;
switch (event->button) {
case 8:
nsgtk_toolbar_item_activate(g->toolbar, BACK_BUTTON);
break;
case 9:
nsgtk_toolbar_item_activate(g->toolbar, FORWARD_BUTTON);
break;
default:
NSLOG(netsurf, DEBUG, "event button %d", event->button);
break;
}
/* If the mouse state is PRESS then we are waiting for a release to emit
* a click event, otherwise just reset the state to nothing */
if (g->mouse.state & BROWSER_MOUSE_PRESS_1)
if (g->mouse.state & BROWSER_MOUSE_PRESS_1) {
g->mouse.state ^= (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_CLICK_1);
else if (g->mouse.state & BROWSER_MOUSE_PRESS_2)
} else if (g->mouse.state & BROWSER_MOUSE_PRESS_2) {
g->mouse.state ^= (BROWSER_MOUSE_PRESS_2 | BROWSER_MOUSE_CLICK_2);
}
/* Handle modifiers being removed */
if (g->mouse.state & BROWSER_MOUSE_MOD_1 && !shift)