Skip to content

Commit c1b0cb1

Browse files
committed
Merge changes from v1
1 parent bc6e252 commit c1b0cb1

27 files changed

+693
-240
lines changed

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dep_argparse = dependency('argparse', version: '>= 3.0', fallback: ['argparse'])
1818
dep_wayland_protocols = dependency('wayland-protocols', version: '>= 1.31')
1919
dep_wayland_scanner = dependency('wayland-scanner')
2020
dep_wayland_server = dependency('wayland-server')
21-
dep_wlroots = dependency('wlroots', version: ['>= 0.18', '< 0.19.0'], fallback: ['wlroots'], default_options: ['examples=false'])
21+
dep_wlroots = dependency('wlroots-0.18', version: ['>= 0.18.0', '< 0.19.0'], fallback: 'wlroots', default_options: ['examples=false'])
2222
dep_xcb = dependency('xcb')
2323
dep_xkbcommon = dependency('xkbcommon')
2424

src/foreign_toplevel.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,57 +9,70 @@
99
#include "wlr-wrap-end.hpp"
1010

1111
static void foreign_toplevel_handle_request_maximize_notify(wl_listener* listener, void* data) {
12+
wlr_log(WLR_DEBUG, "wlr_foreign_toplevel_handle_v1.events.request_maximize(listener=%p, data=%p)", (void*) listener, data);
13+
1214
if (data == nullptr) {
1315
wlr_log(WLR_ERROR, "No data passed to wlr_foreign_toplevel_handle_v1.events.request_maximize");
1416
return;
1517
}
1618

17-
const ForeignToplevelHandle& handle = magpie_container_of(listener, handle, request_activate);
19+
const ForeignToplevelHandle& handle = magpie_container_of(listener, handle, request_maximize);
1820
const auto& event = *static_cast<wlr_foreign_toplevel_handle_v1_maximized_event*>(data);
1921

2022
const auto placement = event.maximized ? VIEW_PLACEMENT_MAXIMIZED : VIEW_PLACEMENT_STACKING;
2123
handle.view.set_placement(placement);
2224
}
2325

2426
static void foreign_toplevel_handle_request_fullscreen_notify(wl_listener* listener, void* data) {
27+
wlr_log(
28+
WLR_DEBUG, "wlr_foreign_toplevel_handle_v1.events.request_fullscreen(listener=%p, data=%p)", (void*) listener, data);
29+
2530
if (data == nullptr) {
2631
wlr_log(WLR_ERROR, "No data passed to wlr_foreign_toplevel_handle_v1.events.request_fullscreen");
2732
return;
2833
}
2934

30-
const ForeignToplevelHandle& handle = magpie_container_of(listener, handle, request_activate);
35+
const ForeignToplevelHandle& handle = magpie_container_of(listener, handle, request_fullscreen);
3136
const auto& event = *static_cast<wlr_foreign_toplevel_handle_v1_maximized_event*>(data);
3237

3338
const auto placement = event.maximized ? VIEW_PLACEMENT_FULLSCREEN : VIEW_PLACEMENT_STACKING;
3439
handle.view.set_placement(placement);
3540
}
3641

3742
static void foreign_toplevel_handle_request_minimize_notify(wl_listener* listener, void* data) {
43+
wlr_log(WLR_DEBUG, "wlr_foreign_toplevel_handle_v1.events.request_minimize(listener=%p, data=%p)", (void*) listener, data);
44+
3845
if (data == nullptr) {
3946
wlr_log(WLR_ERROR, "No data passed to wlr_foreign_toplevel_handle_v1.events.request_minimize");
4047
return;
4148
}
4249

43-
const ForeignToplevelHandle& handle = magpie_container_of(listener, handle, request_activate);
50+
const ForeignToplevelHandle& handle = magpie_container_of(listener, handle, request_minimize);
4451
const auto& event = *static_cast<wlr_foreign_toplevel_handle_v1_minimized_event*>(data);
4552

4653
handle.view.set_minimized(event.minimized);
4754
}
4855

49-
static void foreign_toplevel_handle_request_activate_notify(wl_listener* listener, void*) {
56+
static void foreign_toplevel_handle_request_activate_notify(wl_listener* listener, [[maybe_unused]] void* data) {
57+
wlr_log(WLR_DEBUG, "wlr_foreign_toplevel_handle_v1.events.request_activate(listener=%p, data=%p)", (void*) listener, data);
58+
5059
const ForeignToplevelHandle& handle = magpie_container_of(listener, handle, request_activate);
5160

5261
handle.view.set_minimized(false);
5362
handle.view.get_server().focus_view(std::dynamic_pointer_cast<View>(handle.view.shared_from_this()));
5463
}
5564

56-
static void foreign_toplevel_handle_request_close_notify(wl_listener* listener, void*) {
65+
static void foreign_toplevel_handle_request_close_notify(wl_listener* listener, [[maybe_unused]] void* data) {
66+
wlr_log(WLR_DEBUG, "wlr_foreign_toplevel_handle_v1.events.request_close(listener=%p, data=%p)", (void*) listener, data);
67+
5768
const ForeignToplevelHandle& handle = magpie_container_of(listener, handle, request_close);
5869

5970
handle.view.close();
6071
}
6172

6273
static void foreign_toplevel_handle_set_rectangle_notify(wl_listener* listener, void* data) {
74+
wlr_log(WLR_DEBUG, "wlr_foreign_toplevel_handle_v1.events.set_rectangle(listener=%p, data=%p)", (void*) listener, data);
75+
6376
if (data == nullptr) {
6477
wlr_log(WLR_ERROR, "No data passed to wlr_foreign_toplevel_handle_v1.events.set_rectangle");
6578
return;

src/input/constraint.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77

88
#include "wlr-wrap-start.hpp"
99
#include <wlr/types/wlr_compositor.h>
10+
#include <wlr/util/log.h>
1011
#include "wlr-wrap-end.hpp"
1112

12-
static void constraint_destroy_notify(wl_listener* listener, void*) {
13+
static void constraint_destroy_notify(wl_listener* listener, [[maybe_unused]] void* data) {
14+
wlr_log(WLR_DEBUG, "wlr_pointer_constraint_v1.events.destroy(listener=%p, data=%p)", (void*) listener, data);
15+
1316
PointerConstraint& constraint = magpie_container_of(listener, constraint, destroy);
1417

1518
auto& current_constraint = constraint.seat.current_constraint;

src/input/cursor.cpp

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,23 @@ void Cursor::process_resize(const uint32_t time) const {
5050
int32_t new_top = seat.server.grab_geobox.y;
5151
int32_t new_bottom = seat.server.grab_geobox.y + seat.server.grab_geobox.height;
5252

53-
if (seat.server.resize_edges & WLR_EDGE_TOP) {
53+
if ((seat.server.resize_edges & WLR_EDGE_TOP) != 0) {
5454
new_top = static_cast<int32_t>(std::round(border_y));
5555
if (new_top >= new_bottom) {
5656
new_top = new_bottom - 1;
5757
}
58-
} else if (seat.server.resize_edges & WLR_EDGE_BOTTOM) {
58+
} else if ((seat.server.resize_edges & WLR_EDGE_BOTTOM) != 0) {
5959
new_bottom = static_cast<int32_t>(std::round(border_y));
6060
if (new_bottom <= new_top) {
6161
new_bottom = new_top + 1;
6262
}
6363
}
64-
if (seat.server.resize_edges & WLR_EDGE_LEFT) {
64+
if ((seat.server.resize_edges & WLR_EDGE_LEFT) != 0) {
6565
new_left = static_cast<int32_t>(std::round(border_x));
6666
if (new_left >= new_right) {
6767
new_left = new_right - 1;
6868
}
69-
} else if (seat.server.resize_edges & WLR_EDGE_RIGHT) {
69+
} else if ((seat.server.resize_edges & WLR_EDGE_RIGHT) != 0) {
7070
new_right = static_cast<int32_t>(std::round(border_x));
7171
if (new_right <= new_left) {
7272
new_right = new_left + 1;
@@ -106,8 +106,10 @@ void Cursor::process_move(const uint32_t time) {
106106
/* This event is forwarded by the cursor when a pointer emits an axis event,
107107
* for example when you move the scroll wheel. */
108108
static void cursor_axis_notify(wl_listener* listener, void* data) {
109+
wlr_log(WLR_DEBUG, "wlr_cursor.events.axis(listener=%p, data=%p)", (void*) listener, data);
110+
109111
if (data == nullptr) {
110-
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.cursor_axis");
112+
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.axis");
111113
return;
112114
}
113115

@@ -123,7 +125,7 @@ static void cursor_axis_notify(wl_listener* listener, void* data) {
123125
* event. Frame events are sent after regular pointer events to group
124126
* multiple events together. For instance, two axis events may happen at the
125127
* same time, in which case a frame event won't be sent in between. */
126-
static void cursor_frame_notify(wl_listener* listener, void*) {
128+
static void cursor_frame_notify(wl_listener* listener, [[maybe_unused]] void* data) {
127129
Cursor& cursor = magpie_container_of(listener, cursor, frame);
128130

129131
/* Notify the client with pointer focus of the frame event. */
@@ -145,7 +147,8 @@ static void cursor_motion_absolute_notify(wl_listener* listener, void* data) {
145147
Cursor& cursor = magpie_container_of(listener, cursor, motion_absolute);
146148
const auto* event = static_cast<wlr_pointer_motion_absolute_event*>(data);
147149

148-
double lx, ly;
150+
double lx;
151+
double ly;
149152
wlr_cursor_absolute_to_layout_coords(&cursor.wlr, &event->pointer->base, event->x, event->y, &lx, &ly);
150153

151154
double dx = lx - cursor.wlr.x;
@@ -165,6 +168,8 @@ static void cursor_motion_absolute_notify(wl_listener* listener, void* data) {
165168

166169
/* This event is forwarded by the cursor when a pointer emits a button event. */
167170
static void cursor_button_notify(wl_listener* listener, void* data) {
171+
wlr_log(WLR_DEBUG, "wlr_cursor.events.button(listener=%p, data=%p)", (void*) listener, data);
172+
168173
if (data == nullptr) {
169174
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.button");
170175
return;
@@ -177,7 +182,8 @@ static void cursor_button_notify(wl_listener* listener, void* data) {
177182

178183
/* Notify the client with pointer focus that a button press has occurred */
179184
wlr_seat_pointer_notify_button(server.seat->wlr, event->time_msec, event->button, event->state);
180-
double sx, sy;
185+
double sx;
186+
double sy;
181187

182188
wlr_surface* surface = nullptr;
183189
auto magpie_surface = server.surface_at(cursor.wlr.x, cursor.wlr.y, &surface, &sx, &sy).lock();
@@ -189,7 +195,7 @@ static void cursor_button_notify(wl_listener* listener, void* data) {
189195
}
190196
} else if (magpie_surface != nullptr && magpie_surface->is_view()) {
191197
/* Focus that client if the button was _pressed_ */
192-
server.focus_view(std::dynamic_pointer_cast<View>(magpie_surface), surface);
198+
server.focus_view(std::dynamic_pointer_cast<View>(magpie_surface));
193199
} else {
194200
server.focus_view(nullptr);
195201
}
@@ -222,8 +228,10 @@ static void cursor_motion_notify(wl_listener* listener, void* data) {
222228
}
223229

224230
static void gesture_pinch_begin_notify(wl_listener* listener, void* data) {
231+
wlr_log(WLR_DEBUG, "wlr_cursor.events.gesture_pinch_begin(listener=%p, data=%p)", (void*) listener, data);
232+
225233
if (data == nullptr) {
226-
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.pinch_begin");
234+
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.gesture_pinch_begin");
227235
return;
228236
}
229237

@@ -235,7 +243,7 @@ static void gesture_pinch_begin_notify(wl_listener* listener, void* data) {
235243

236244
static void gesture_pinch_update_notify(wl_listener* listener, void* data) {
237245
if (data == nullptr) {
238-
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.pinch_update");
246+
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.gesture_pinch_update");
239247
return;
240248
}
241249

@@ -247,8 +255,10 @@ static void gesture_pinch_update_notify(wl_listener* listener, void* data) {
247255
}
248256

249257
static void gesture_pinch_end_notify(wl_listener* listener, void* data) {
258+
wlr_log(WLR_DEBUG, "wlr_cursor.events.gesture_pinch_end(listener=%p, data=%p)", (void*) listener, data);
259+
250260
if (data == nullptr) {
251-
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.pinch_end");
261+
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.gesture_pinch_end");
252262
return;
253263
}
254264

@@ -259,8 +269,10 @@ static void gesture_pinch_end_notify(wl_listener* listener, void* data) {
259269
}
260270

261271
static void gesture_swipe_begin_notify(wl_listener* listener, void* data) {
272+
wlr_log(WLR_DEBUG, "wlr_cursor.events.gesture_swipe_begin(listener=%p, data=%p)", (void*) listener, data);
273+
262274
if (data == nullptr) {
263-
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.swipe_begin");
275+
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.gesture_swipe_begin");
264276
return;
265277
}
266278

@@ -272,7 +284,7 @@ static void gesture_swipe_begin_notify(wl_listener* listener, void* data) {
272284

273285
static void gesture_swipe_update_notify(wl_listener* listener, void* data) {
274286
if (data == nullptr) {
275-
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.swipe_update");
287+
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.gesture_swipe_update");
276288
return;
277289
}
278290

@@ -283,8 +295,10 @@ static void gesture_swipe_update_notify(wl_listener* listener, void* data) {
283295
}
284296

285297
static void gesture_swipe_end_notify(wl_listener* listener, void* data) {
298+
wlr_log(WLR_DEBUG, "wlr_cursor.events.gesture_swipe_end(listener=%p, data=%p)", (void*) listener, data);
299+
286300
if (data == nullptr) {
287-
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.swipe_end");
301+
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.gesture_swipe_end");
288302
return;
289303
}
290304

@@ -295,8 +309,10 @@ static void gesture_swipe_end_notify(wl_listener* listener, void* data) {
295309
}
296310

297311
static void gesture_hold_begin_notify(wl_listener* listener, void* data) {
312+
wlr_log(WLR_DEBUG, "wlr_cursor.events.gesture_hold_begin(listener=%p, data=%p)", (void*) listener, data);
313+
298314
if (data == nullptr) {
299-
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.hold_begin");
315+
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.gesture_hold_begin");
300316
return;
301317
}
302318

@@ -307,8 +323,10 @@ static void gesture_hold_begin_notify(wl_listener* listener, void* data) {
307323
}
308324

309325
static void gesture_hold_end_notify(wl_listener* listener, void* data) {
326+
wlr_log(WLR_DEBUG, "wlr_cursor.events.gesture_hold_end(listener=%p, data=%p)", (void*) listener, data);
327+
310328
if (data == nullptr) {
311-
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.hold_end");
329+
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.gesture_hold_end");
312330
return;
313331
}
314332

@@ -319,6 +337,8 @@ static void gesture_hold_end_notify(wl_listener* listener, void* data) {
319337
}
320338

321339
static void request_set_shape_notify(wl_listener* listener, void* data) {
340+
wlr_log(WLR_DEBUG, "wlr_cursor.events.set_shape(listener=%p, data=%p)", (void*) listener, data);
341+
322342
if (data == nullptr) {
323343
wlr_log(WLR_ERROR, "No data passed to wlr_cursor.events.set_shape");
324344
return;
@@ -412,7 +432,8 @@ void Cursor::process_motion(const uint32_t time) {
412432
}
413433

414434
/* Otherwise, find the view under the pointer and send the event along. */
415-
double sx, sy;
435+
double sx;
436+
double sy;
416437
wlr_surface* surface = nullptr;
417438
auto magpie_surface = seat.server.surface_at(wlr.x, wlr.y, &surface, &sx, &sy).lock();
418439
if (magpie_surface == nullptr) {
@@ -464,7 +485,7 @@ void Cursor::warp_to_constraint(const PointerConstraint& constraint) const {
464485
return;
465486
}
466487

467-
if (constraint.wlr.current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT) {
488+
if ((constraint.wlr.current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT) != 0) {
468489
const double x = constraint.wlr.current.cursor_hint.x;
469490
const double y = constraint.wlr.current.cursor_hint.y;
470491

src/input/cursor.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class Cursor final : public std::enable_shared_from_this<Cursor> {
2525
wl_listener button = {};
2626
wl_listener axis = {};
2727
wl_listener frame = {};
28-
wl_listener new_constraint = {};
2928
wl_listener gesture_pinch_begin = {};
3029
wl_listener gesture_pinch_update = {};
3130
wl_listener gesture_pinch_end = {};

src/input/keyboard.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
/* This event is raised by the keyboard base wlr_input_device to signal
1919
* the destruction of the wlr_keyboard. It will no longer receive events
2020
* and should be destroyed. */
21-
static void keyboard_handle_destroy(wl_listener* listener, void*) {
21+
static void keyboard_handle_destroy(wl_listener* listener, [[maybe_unused]] void* data) {
22+
wlr_log(WLR_DEBUG, "wlr_keyboard.events.destroy(listener=%p, data=%p)", (void*) listener, data);
23+
2224
Keyboard& keyboard = magpie_container_of(listener, keyboard, destroy);
2325

2426
auto& keyboards = keyboard.seat.keyboards;
@@ -51,6 +53,8 @@ static bool handle_compositor_keybinding(const Keyboard& keyboard, const uint32_
5153

5254
/* This event is raised when a key is pressed or released. */
5355
static void keyboard_handle_key(wl_listener* listener, void* data) {
56+
wlr_log(WLR_DEBUG, "wlr_keyboard.events.key(listener=%p, data=%p)", (void*) listener, data);
57+
5458
if (data == nullptr) {
5559
wlr_log(WLR_ERROR, "No data passed to wlr_keyboard.events.key");
5660
return;
@@ -71,7 +75,7 @@ static void keyboard_handle_key(wl_listener* listener, void* data) {
7175
bool handled = false;
7276
const uint32_t modifiers = wlr_keyboard_get_modifiers(&keyboard.wlr);
7377
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
74-
if (modifiers & WLR_MODIFIER_ALT) {
78+
if ((modifiers & WLR_MODIFIER_ALT) != 0) {
7579
/* If alt is held down and this button was _pressed_, we attempt to
7680
* process it as a compositor keybinding. */
7781
for (int32_t i = 0; i < nsyms; i++) {
@@ -89,7 +93,7 @@ static void keyboard_handle_key(wl_listener* listener, void* data) {
8993

9094
/* This event is raised when a modifier key, such as shift or alt, is
9195
* pressed. We simply communicate this to the client. */
92-
static void keyboard_handle_modifiers(wl_listener* listener, void*) {
96+
static void keyboard_handle_modifiers(wl_listener* listener, [[maybe_unused]] void* data) {
9397
Keyboard& keyboard = magpie_container_of(listener, keyboard, modifiers);
9498

9599
/*

0 commit comments

Comments
 (0)