#include "tree.h"
/** Callback for dragging */
-typedef void(*callback_t)(Con*, Rect*, uint32_t, uint32_t, void*);
+typedef void(*callback_t)(Con*, Rect*, uint32_t, uint32_t, const void*);
/** Macro to create a callback function for dragging */
#define DRAGGING_CB(name) \
static void name(Con *con, Rect *old_rect, uint32_t new_x, \
- uint32_t new_y, void *extra)
+ uint32_t new_y, const void *extra)
/** On which border was the dragging initiated? */
typedef enum { BORDER_LEFT = (1 << 0),
* Calls the drag_pointer function with the drag_window callback
*
*/
-void floating_drag_window(Con *con, xcb_button_press_event_t *event);
+void floating_drag_window(Con *con, const xcb_button_press_event_t *event);
/**
* Called when the user clicked on a floating window while holding the
* Calls the drag_pointer function with the resize_window callback
*
*/
-void floating_resize_window(Con *con, bool proportional, xcb_button_press_event_t *event);
+void floating_resize_window(Con *con, const bool proportional, const xcb_button_press_event_t *event);
#if 0
/**
* the event and the new coordinates (x, y).
*
*/
-void drag_pointer(Con *con, xcb_button_press_event_t *event,
+void drag_pointer(Con *con, const xcb_button_press_event_t *event,
xcb_window_t confine_to, border_t border, callback_t callback,
- void *extra);
+ const void *extra);
#endif
#ifndef _RESIZE_H
#define _RESIZE_H
-int resize_graphical_handler(Con *first, Con *second, orientation_t orientation, xcb_button_press_event_t *event);
+int resize_graphical_handler(Con *first, Con *second, orientation_t orientation, const xcb_button_press_event_t *event);
#endif
* then calls resize_graphical_handler().
*
*/
-static bool tiling_resize_for_border(Con *con, border_t border, xcb_button_press_event_t *event) {
+static bool tiling_resize_for_border(Con *con, border_t border, const xcb_button_press_event_t *event) {
DLOG("border = %d\n", border);
char way = (border == BORDER_TOP || border == BORDER_LEFT ? 'p' : 'n');
orientation_t orientation = (border == BORDER_TOP || border == BORDER_BOTTOM ? VERT : HORIZ);
* to the client).
*
*/
-static bool floating_mod_on_tiled_client(Con *con, xcb_button_press_event_t *event) {
+static bool floating_mod_on_tiled_client(Con *con, const xcb_button_press_event_t *event) {
/* The client is in tiling layout. We can still initiate a resize with the
* right mouse button, by chosing the border which is the most near one to
* the position of the mouse pointer */
* Finds out which border was clicked on and calls tiling_resize_for_border().
*
*/
-static bool tiling_resize(Con *con, xcb_button_press_event_t *event, click_destination_t dest) {
+static bool tiling_resize(Con *con, const xcb_button_press_event_t *event, const click_destination_t dest) {
/* check if this was a click on the window border (and on which one) */
Rect bsr = con_border_style_rect(con);
DLOG("BORDER x = %d, y = %d for con %p, window 0x%08x\n",
* functions for resizing/dragging.
*
*/
-static int route_click(Con *con, xcb_button_press_event_t *event, bool mod_pressed, click_destination_t dest) {
+static int route_click(Con *con, const xcb_button_press_event_t *event, const bool mod_pressed, const click_destination_t dest) {
DLOG("--> click properties: mod = %d, destination = %d\n", mod_pressed, dest);
DLOG("--> OUTCOME = %p\n", con);
DLOG("type = %d, name = %s\n", con->type, con->name);
last_timestamp = event->time;
const uint32_t mod = config.floating_modifier;
- bool mod_pressed = (mod != 0 && (event->state & mod) == mod);
+ const bool mod_pressed = (mod != 0 && (event->state & mod) == mod);
DLOG("floating_mod = %d, detail = %d\n", mod_pressed, event->detail);
if ((con = con_by_window_id(event->event)))
return route_click(con, event, mod_pressed, CLICK_INSIDE);
}
DRAGGING_CB(drag_window_callback) {
- struct xcb_button_press_event_t *event = extra;
+ const struct xcb_button_press_event_t *event = extra;
/* Reposition the client correctly while moving */
con->rect.x = old_rect->x + (new_x - event->root_x);
* Calls the drag_pointer function with the drag_window callback
*
*/
-void floating_drag_window(Con *con, xcb_button_press_event_t *event) {
+void floating_drag_window(Con *con, const xcb_button_press_event_t *event) {
DLOG("floating_drag_window\n");
/* Push changes before dragging, so that the window gets raised now and not
*
*/
struct resize_window_callback_params {
- border_t corner;
- bool proportional;
- xcb_button_press_event_t *event;
+ const border_t corner;
+ const bool proportional;
+ const xcb_button_press_event_t *event;
};
DRAGGING_CB(resize_window_callback) {
- struct resize_window_callback_params *params = extra;
- xcb_button_press_event_t *event = params->event;
+ const struct resize_window_callback_params *params = extra;
+ const xcb_button_press_event_t *event = params->event;
border_t corner = params->corner;
int32_t dest_x = con->rect.x;
* Calls the drag_pointer function with the resize_window callback
*
*/
-void floating_resize_window(Con *con, bool proportional,
- xcb_button_press_event_t *event) {
+void floating_resize_window(Con *con, const bool proportional,
+ const xcb_button_press_event_t *event) {
DLOG("floating_resize_window\n");
/* corner saves the nearest corner to the original click. It contains
* the event and the new coordinates (x, y).
*
*/
-void drag_pointer(Con *con, xcb_button_press_event_t *event, xcb_window_t
- confine_to, border_t border, callback_t callback, void *extra)
+void drag_pointer(Con *con, const xcb_button_press_event_t *event, xcb_window_t
+ confine_to, border_t border, callback_t callback, const void *extra)
{
uint32_t new_x, new_y;
Rect old_rect;
};
DRAGGING_CB(resize_callback) {
- struct callback_params *params = extra;
+ const struct callback_params *params = extra;
Con *output = params->output;
DLOG("new x = %d, y = %d\n", new_x, new_y);
if (params->orientation == HORIZ) {
xcb_flush(conn);
}
-int resize_graphical_handler(Con *first, Con *second, orientation_t orientation, xcb_button_press_event_t *event) {
+int resize_graphical_handler(Con *first, Con *second, orientation_t orientation, const xcb_button_press_event_t *event) {
DLOG("resize handler\n");
uint32_t new_position;
xcb_flush(conn);
- struct callback_params params = { orientation, output, helpwin, &new_position };
+ const struct callback_params params = { orientation, output, helpwin, &new_position };
drag_pointer(NULL, event, grabwin, BORDER_TOP, resize_callback, ¶ms);