mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 02:50:41 -05:00
display: get button event coordinates with the helper functions
This commit is contained in:
parent
4c4f21c001
commit
748954a15e
@ -1721,6 +1721,7 @@ event_callback (XEvent *event,
|
|||||||
{
|
{
|
||||||
Window xwindow = meta_input_event_get_window (display, event);
|
Window xwindow = meta_input_event_get_window (display, event);
|
||||||
Time evtime = meta_input_event_get_time (display, event);
|
Time evtime = meta_input_event_get_time (display, event);
|
||||||
|
gdouble ev_root_x, ev_root_y;
|
||||||
guint n_button, state;
|
guint n_button, state;
|
||||||
|
|
||||||
if (window && !window->override_redirect &&
|
if (window && !window->override_redirect &&
|
||||||
@ -1762,6 +1763,10 @@ event_callback (XEvent *event,
|
|||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
meta_input_event_get_button (display, event, &n_button);
|
meta_input_event_get_button (display, event, &n_button);
|
||||||
meta_input_event_get_state (display, event, &state);
|
meta_input_event_get_state (display, event, &state);
|
||||||
|
meta_input_event_get_coordinates (display, event,
|
||||||
|
NULL, NULL,
|
||||||
|
&ev_root_x,
|
||||||
|
&ev_root_y);
|
||||||
|
|
||||||
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
|
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
|
||||||
break;
|
break;
|
||||||
@ -1861,10 +1866,10 @@ event_callback (XEvent *event,
|
|||||||
|
|
||||||
meta_window_get_position (window, &root_x, &root_y);
|
meta_window_get_position (window, &root_x, &root_y);
|
||||||
|
|
||||||
west = event->xbutton.x_root < (root_x + 1 * window->rect.width / 3);
|
west = ev_root_x < (root_x + 1 * window->rect.width / 3);
|
||||||
east = event->xbutton.x_root > (root_x + 2 * window->rect.width / 3);
|
east = ev_root_x > (root_x + 2 * window->rect.width / 3);
|
||||||
north = event->xbutton.y_root < (root_y + 1 * window->rect.height / 3);
|
north = ev_root_y < (root_y + 1 * window->rect.height / 3);
|
||||||
south = event->xbutton.y_root > (root_y + 2 * window->rect.height / 3);
|
south = ev_root_y > (root_y + 2 * window->rect.height / 3);
|
||||||
|
|
||||||
if (north && west)
|
if (north && west)
|
||||||
op = META_GRAB_OP_RESIZING_NW;
|
op = META_GRAB_OP_RESIZING_NW;
|
||||||
@ -1895,8 +1900,8 @@ event_callback (XEvent *event,
|
|||||||
n_button,
|
n_button,
|
||||||
0,
|
0,
|
||||||
evtime,
|
evtime,
|
||||||
event->xbutton.x_root,
|
ev_root_x,
|
||||||
event->xbutton.y_root);
|
ev_root_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (n_button == meta_prefs_get_mouse_button_menu())
|
else if (n_button == meta_prefs_get_mouse_button_menu())
|
||||||
@ -1904,8 +1909,8 @@ event_callback (XEvent *event,
|
|||||||
if (meta_prefs_get_raise_on_click ())
|
if (meta_prefs_get_raise_on_click ())
|
||||||
meta_window_raise (window);
|
meta_window_raise (window);
|
||||||
meta_window_show_menu (window,
|
meta_window_show_menu (window,
|
||||||
event->xbutton.x_root,
|
ev_root_x,
|
||||||
event->xbutton.y_root,
|
ev_root_y,
|
||||||
n_button,
|
n_button,
|
||||||
evtime);
|
evtime);
|
||||||
}
|
}
|
||||||
@ -1952,8 +1957,8 @@ event_callback (XEvent *event,
|
|||||||
n_button,
|
n_button,
|
||||||
0,
|
0,
|
||||||
evtime,
|
evtime,
|
||||||
event->xbutton.x_root,
|
ev_root_x,
|
||||||
event->xbutton.y_root);
|
ev_root_y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user