KiCad PCB EDA Suite
Loading...
Searching...
No Matches
wxgtk/ui.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 Ian McInerney <Ian.S.McInerney at ieee.org>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <kiplatform/ui.h>
22
23#include <wx/choice.h>
24#include <wx/nonownedwnd.h>
25#include <wx/settings.h>
26#include <wx/window.h>
27#include <wx/log.h>
28
29#include <gtk/gtk.h>
30#include <gdk/gdk.h>
31
32#ifdef GDK_WINDOWING_X11
33#include <gdk/gdkx.h>
34#endif
35
36#ifdef GDK_WINDOWING_WAYLAND
37#include <gdk/gdkwayland.h>
38#endif
39
40#ifdef KICAD_WAYLAND
42#endif
43
44// Set WXTRACE=KICAD_WAYLAND to see logs
45const wxString traceWayland = wxS( "KICAD_WAYLAND" );
46
47
49{
50 wxColour bg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
51
52 // Weighted W3C formula
53 double brightness = ( bg.Red() / 255.0 ) * 0.299 +
54 ( bg.Green() / 255.0 ) * 0.587 +
55 ( bg.Blue() / 255.0 ) * 0.117;
56
57 return brightness < 0.5;
58}
59
60
62{
63 return wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
64}
65
66
67void KIPLATFORM::UI::GetInfoBarColours( wxColour& aFgColour, wxColour& aBgColour )
68{
69 // The GTK3.24 way of getting the colours is to use the style context
70 // Earlier GTKs should be able to use the system settings
71#if( GTK_CHECK_VERSION( 3, 24, 0 ) )
72 GdkRGBA* rgba;
73 GtkWidgetPath* path = gtk_widget_path_new();
74 GtkStyleContext* sc = gtk_style_context_new();
75
76 gtk_widget_path_append_type( path, GTK_TYPE_WINDOW );
77 gtk_widget_path_iter_set_object_name( path, -1, "infobar" );
78 gtk_widget_path_iter_add_class( path, -1, "info" );
79
80 gtk_style_context_set_path( sc, path );
81 gtk_style_context_set_state( sc, GTK_STATE_FLAG_NORMAL );
82
83 gtk_style_context_get( sc, GTK_STATE_FLAG_NORMAL, "background-color", &rgba, NULL );
84 aBgColour = wxColour( *rgba );
85 gdk_rgba_free( rgba );
86
87 gtk_style_context_get( sc, GTK_STATE_FLAG_NORMAL, "color", &rgba, NULL );
88 aFgColour = wxColour( *rgba );
89 gdk_rgba_free( rgba );
90
91 // Some GTK themes use the plain infobar style, but if they don't, the background alpha
92 // is generally 0. In this case, try the revealer and box as these are used for Adwaita
93 // and other themes.
94 if( aBgColour.Alpha() == 0 )
95 {
96 gtk_widget_path_append_type( path, G_TYPE_NONE );
97 gtk_widget_path_iter_set_object_name( path, -1, "revealer" );
98 gtk_widget_path_append_type( path, G_TYPE_NONE );
99 gtk_widget_path_iter_set_object_name( path, -1, "box" );
100
101 gtk_style_context_set_path( sc, path );
102 gtk_style_context_set_state( sc, GTK_STATE_FLAG_NORMAL );
103
104 gtk_style_context_get( sc, GTK_STATE_FLAG_NORMAL, "background-color", &rgba, NULL );
105 aBgColour = wxColour( *rgba );
106 gdk_rgba_free( rgba );
107
108 gtk_style_context_get( sc, GTK_STATE_FLAG_NORMAL, "color", &rgba, NULL );
109 aFgColour = wxColour( *rgba );
110 gdk_rgba_free( rgba );
111 }
112
113 gtk_widget_path_free( path );
114 g_object_unref( sc );
115
116#else
117 aBgColour = wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK );
118 aFgColour = wxSystemSettings::GetColour( wxSYS_COLOUR_INFOTEXT );
119#endif
120
121}
122
123
124void KIPLATFORM::UI::ForceFocus( wxWindow* aWindow )
125{
126 aWindow->SetFocus();
127}
128
129
130bool KIPLATFORM::UI::IsWindowActive( wxWindow* aWindow )
131{
132 if( !aWindow )
133 return false;
134
135 GtkWindow* window = GTK_WINDOW( aWindow->GetHandle() );
136
137 if( window )
138 return gtk_window_is_active( window );
139
140 // We shouldn't really ever reach this point
141 return false;
142}
143
144
145void KIPLATFORM::UI::EnsureVisible( wxWindow* aWindow )
146{
147 // Not needed on this platform
148}
149
150
151void KIPLATFORM::UI::ReparentModal( wxNonOwnedWindow* aWindow )
152{
153 // Not needed on this platform
154}
155
156
158{
159 // Not needed on this platform
160}
161
162
163bool KIPLATFORM::UI::IsStockCursorOk( wxStockCursor aCursor )
164{
165 switch( aCursor )
166 {
167 case wxCURSOR_BULLSEYE:
168 case wxCURSOR_HAND:
169 case wxCURSOR_ARROW:
170 case wxCURSOR_BLANK:
171 return true;
172 default:
173 return false;
174 }
175}
176
177
186static void disable_area_apply_attributes_cb( GtkWidget* pItem, gpointer userdata )
187{
188 // GTK needs this enormous chain to get the actual type of item that we want
189 GtkMenuItem* pMenuItem = GTK_MENU_ITEM( pItem );
190 GtkWidget* child = gtk_bin_get_child( GTK_BIN( pMenuItem ) );
191 GtkCellView* pCellView = GTK_CELL_VIEW( child );
192 GtkCellLayout* pCellLayout = GTK_CELL_LAYOUT( pCellView );
193 GtkCellArea* pCellArea = gtk_cell_layout_get_area( pCellLayout );
194
195 g_signal_handlers_block_matched( pCellArea, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, userdata );
196}
197
198
199void KIPLATFORM::UI::LargeChoiceBoxHack( wxChoice* aChoice )
200{
201 AtkObject* atkObj = gtk_combo_box_get_popup_accessible( GTK_COMBO_BOX( aChoice->m_widget ) );
202
203 if( !atkObj || !GTK_IS_ACCESSIBLE( atkObj ) )
204 return;
205
206 GtkWidget* widget = gtk_accessible_get_widget( GTK_ACCESSIBLE( atkObj ) );
207
208 if( !widget || !GTK_IS_MENU( widget ) )
209 return;
210
211 GtkMenu* menu = GTK_MENU( widget );
212
213 gtk_container_foreach( GTK_CONTAINER( menu ), disable_area_apply_attributes_cb, menu );
214}
215
216
217void KIPLATFORM::UI::EllipsizeChoiceBox( wxChoice* aChoice )
218{
219 // This function is based on the code inside the function post_process_ui in
220 // gtkfilechooserwidget.c
221 GList* cells = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( aChoice->m_widget ) );
222
223 if( !cells )
224 return;
225
226 GtkCellRenderer* cell = (GtkCellRenderer*) cells->data;
227
228 if( !cell )
229 return;
230
231 g_object_set( G_OBJECT( cell ), "ellipsize", PANGO_ELLIPSIZE_END, nullptr );
232
233 // Only the list of cells must be freed, the renderer isn't ours to free
234 g_list_free( cells );
235}
236
237
238double KIPLATFORM::UI::GetPixelScaleFactor( const wxWindow* aWindow )
239{
240 double val = 1.0;
241
242 GtkWidget* widget = static_cast<GtkWidget*>( aWindow->GetHandle() );
243
244 if( widget && gtk_check_version( 3, 10, 0 ) == nullptr )
245 val = gtk_widget_get_scale_factor( widget );
246
247 return val;
248}
249
250
251double KIPLATFORM::UI::GetContentScaleFactor( const wxWindow* aWindow )
252{
253 // TODO: Do we need something different here?
254 return GetPixelScaleFactor( aWindow );
255}
256
257
258wxSize KIPLATFORM::UI::GetUnobscuredSize( const wxWindow* aWindow )
259{
260 return wxSize( aWindow->GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X ),
261 aWindow->GetSize().GetY() - wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ) );
262}
263
264
265void KIPLATFORM::UI::SetOverlayScrolling( const wxWindow* aWindow, bool overlay )
266{
267 gtk_scrolled_window_set_overlay_scrolling( GTK_SCROLLED_WINDOW( aWindow->GetHandle() ),
268 overlay );
269}
270
271
273{
274 gboolean allowed = 1;
275
276 g_object_get( gtk_settings_get_default(), "gtk-menu-images", &allowed, NULL );
277
278 return !!allowed;
279}
280
281
282#if defined( GDK_WINDOWING_WAYLAND ) && defined( KICAD_WAYLAND )
283
284static bool wayland_warp_pointer( GtkWidget* aWidget, GdkDisplay* aDisplay, GdkWindow* aWindow,
285 GdkDevice* aPtrDev, int aX, int aY );
286
287// GDK doesn't know if we've moved the cursor using Wayland pointer constraints.
288// So emulate the actual position here
289static wxPoint s_warped_from;
290static wxPoint s_warped_to;
291
293{
294 wxPoint wx_pos = wxGetMousePosition();
295
296 if( wx_pos == s_warped_from )
297 {
298 wxLogTrace( traceWayland, wxS( "Faked mouse pos %d %d -> %d %d" ), wx_pos.x, wx_pos.y,
299 s_warped_to.x, s_warped_to.y );
300
301 return s_warped_to;
302 }
303 else
304 {
305 // Mouse has moved
306 s_warped_from = wxPoint();
307 s_warped_to = wxPoint();
308 }
309
310 return wx_pos;
311}
312
313#endif
314
315
316bool KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
317{
318 if( !wxGetEnv( wxT( "WAYLAND_DISPLAY" ), nullptr ) )
319 {
320 aWindow->WarpPointer( aX, aY );
321 return true;
322 }
323 else
324 {
325 GtkWidget* widget = static_cast<GtkWidget*>( aWindow->GetHandle() );
326
327 GdkDisplay* disp = gtk_widget_get_display( widget );
328 GdkSeat* seat = gdk_display_get_default_seat( disp );
329 GdkDevice* ptrdev = gdk_seat_get_pointer( seat );
330
331#if defined( GDK_WINDOWING_WAYLAND ) && defined( KICAD_WAYLAND )
332 if( GDK_IS_WAYLAND_DISPLAY( disp ) )
333 {
334 wxPoint initialPos = wxGetMousePosition();
335 GdkWindow* win = aWindow->GTKGetDrawingWindow();
336
337 if( wayland_warp_pointer( widget, disp, win, ptrdev, aX, aY ) )
338 {
339 s_warped_from = initialPos;
340 s_warped_to = aWindow->ClientToScreen( wxPoint( aX, aY ) );
341
342 wxLogTrace( traceWayland, wxS( "Set warped from %d %d to %d %d" ), s_warped_from.x,
343 s_warped_from.y, s_warped_to.x, s_warped_to.y );
344
345 return true;
346 }
347
348 wxLogTrace( traceWayland, wxS( "*** Warp to %d %d failed ***" ), aX, aY );
349
350 return false;
351 }
352#endif
353#ifdef GDK_WINDOWING_X11
354 if( GDK_IS_X11_DISPLAY( disp ) )
355 {
356 GdkWindow* win = gdk_device_get_window_at_position( ptrdev, nullptr, nullptr );
357 GdkCursor* blank_cursor = gdk_cursor_new_for_display( disp, GDK_BLANK_CURSOR );
358 GdkCursor* cur_cursor = gdk_window_get_cursor( win );
359
360 if( cur_cursor )
361 g_object_ref( cur_cursor );
362
363 gdk_window_set_cursor( win, blank_cursor );
364 aWindow->WarpPointer( aX, aY );
365 gdk_window_set_cursor( win, cur_cursor );
366
367 if( cur_cursor )
368 g_object_unref( cur_cursor );
369
370 if( blank_cursor )
371 g_object_unref( blank_cursor );
372
373 return true;
374 }
375#endif
376 }
377
378 return false;
379}
380
381
382void KIPLATFORM::UI::ImmControl( wxWindow* aWindow, bool aEnable )
383{
384}
385
386
388{
389 wxWindowGTK* win = static_cast<wxWindowGTK*>( aWindow );
390 if( win )
391 {
392 GtkIMContext* imContext = win->m_imContext;
393 if( imContext )
394 {
395 gtk_im_context_focus_out( imContext );
396 }
397 }
398}
399
400
401void KIPLATFORM::UI::SetFloatLevel( wxWindow* aWindow )
402{
403}
404
405//
406// **** Wayland hacks ahead ****
407//
408
409#if defined( GDK_WINDOWING_WAYLAND ) && defined( KICAD_WAYLAND )
410
411static bool s_wl_initialized = false;
412static struct wl_compositor* s_wl_compositor = NULL;
413static struct zwp_pointer_constraints_v1* s_wl_pointer_constraints = NULL;
414static struct zwp_confined_pointer_v1* s_wl_confined_pointer = NULL;
415static struct wl_region* s_wl_confinement_region = NULL;
416static bool s_wl_locked_flag = false;
417
418static void handle_global( void* data, struct wl_registry* registry, uint32_t name,
419 const char* interface, uint32_t version )
420{
421 wxLogTrace( traceWayland, "handle_global received %s name %u version %u", interface,
422 (unsigned int) name, (unsigned int) version );
423
424 if( strcmp( interface, wl_compositor_interface.name ) == 0 )
425 {
426 s_wl_compositor = static_cast<wl_compositor*>(
427 wl_registry_bind( registry, name, &wl_compositor_interface, version ) );
428 }
429 else if( strcmp( interface, zwp_pointer_constraints_v1_interface.name ) == 0 )
430 {
431 s_wl_pointer_constraints = static_cast<zwp_pointer_constraints_v1*>( wl_registry_bind(
432 registry, name, &zwp_pointer_constraints_v1_interface, version ) );
433 }
434}
435
436static void handle_global_remove( void*, struct wl_registry*, uint32_t name )
437{
438 wxLogTrace( traceWayland, "handle_global_remove name %u", (unsigned int) name );
439}
440
441static const struct wl_registry_listener registry_listener = {
442 .global = handle_global,
443 .global_remove = handle_global_remove,
444};
445
446static void confined_handler( void* data, struct zwp_confined_pointer_v1* zwp_confined_pointer_v1 )
447{
448 wxLogTrace( traceWayland, wxS( "Pointer confined" ) );
449}
450
451static void unconfined_handler( void* data,
452 struct zwp_confined_pointer_v1* zwp_confined_pointer_v1 )
453{
454 wxLogTrace( traceWayland, wxS( "Pointer unconfined" ) );
455}
456
457static const struct zwp_confined_pointer_v1_listener confined_pointer_listener = {
458 .confined = confined_handler,
459 .unconfined = unconfined_handler
460};
461
462static void locked_handler( void* data, struct zwp_locked_pointer_v1* zwp_locked_pointer_v1 )
463{
464 s_wl_locked_flag = true;
465 wxLogTrace( traceWayland, wxS( "Pointer locked" ) );
466}
467
468static void unlocked_handler( void* data, struct zwp_locked_pointer_v1* zwp_locked_pointer_v1 )
469{
470 wxLogTrace( traceWayland, wxS( "Pointer unlocked" ) );
471}
472
473static const struct zwp_locked_pointer_v1_listener locked_pointer_listener = {
474 .locked = locked_handler,
475 .unlocked = unlocked_handler
476};
477
478
482static void initialize_wayland( wl_display* wldisp )
483{
484 if( s_wl_initialized )
485 {
486 return;
487 }
488
489 struct wl_registry* registry = wl_display_get_registry( wldisp );
490 wl_registry_add_listener( registry, &registry_listener, NULL );
491 wl_display_roundtrip( wldisp );
492 s_wl_initialized = true;
493}
494
495
496struct zwp_locked_pointer_v1* s_wl_locked_pointer = NULL;
497
498static int s_after_paint_handler_id = 0;
499
500static void on_frame_clock_after_paint( GdkFrameClock* clock, GtkWidget* widget )
501{
502 if( s_wl_locked_pointer )
503 {
504 zwp_locked_pointer_v1_destroy( s_wl_locked_pointer );
505 s_wl_locked_pointer = NULL;
506
507 wxLogTrace( traceWayland, wxS( "after-paint: locked_pointer destroyed" ) );
508
509 g_signal_handler_disconnect( (gpointer) clock, s_after_paint_handler_id );
510 s_after_paint_handler_id = 0;
511
512 // restore confinement
513 if( s_wl_confinement_region != NULL )
514 {
515 wxLogTrace( traceWayland, wxS( "after-paint: Restoring confinement" ) );
516
517 GdkDisplay* disp = gtk_widget_get_display( widget );
518 GdkSeat* seat = gdk_display_get_default_seat( disp );
519 GdkDevice* ptrdev = gdk_seat_get_pointer( seat );
520 GdkWindow* window = gtk_widget_get_window( widget );
521
522 wl_display* wldisp = gdk_wayland_display_get_wl_display( disp );
523 wl_surface* wlsurf = gdk_wayland_window_get_wl_surface( window );
524 wl_pointer* wlptr = gdk_wayland_device_get_wl_pointer( ptrdev );
525
526 s_wl_confined_pointer = zwp_pointer_constraints_v1_confine_pointer(
527 s_wl_pointer_constraints, wlsurf, wlptr, s_wl_confinement_region,
529
530 wl_display_roundtrip( wldisp );
531 }
532 }
533}
534
535
536static bool wayland_warp_pointer( GtkWidget* aWidget, GdkDisplay* aDisplay, GdkWindow* aWindow,
537 GdkDevice* aPtrDev, int aX, int aY )
538{
539 wl_display* wldisp = gdk_wayland_display_get_wl_display( aDisplay );
540 wl_surface* wlsurf = gdk_wayland_window_get_wl_surface( aWindow );
541 wl_pointer* wlptr = gdk_wayland_device_get_wl_pointer( aPtrDev );
542
543 if( s_after_paint_handler_id )
544 {
545 // Previous paint not done yet
546 wxLogTrace( traceWayland, wxS( "Not warping: after-paint pending" ) );
547 return false;
548 }
549
550 initialize_wayland( wldisp );
551
552 if( s_wl_locked_pointer )
553 {
554 // This shouldn't happen but let's be safe
555 wxLogTrace( traceWayland, wxS( "** Destroying previous locked_pointer **" ) );
556 zwp_locked_pointer_v1_destroy( s_wl_locked_pointer );
557 wl_display_roundtrip( wldisp );
558 s_wl_locked_pointer = NULL;
559 }
560
561 // wl_surface_commit causes an assert on GNOME, but has to be called on KDE
562 // before destroying the locked pointer, so wait until GDK commits the surface.
563 GdkFrameClock* frame_clock = gdk_window_get_frame_clock( aWindow );
564 s_after_paint_handler_id = g_signal_connect_after(
565 frame_clock, "after-paint", G_CALLBACK( on_frame_clock_after_paint ), aWidget );
566
567 // temporary disable confinement to allow pointer warping
568 if( s_wl_confinement_region && s_wl_confined_pointer )
569 {
570 zwp_confined_pointer_v1_destroy( s_wl_confined_pointer );
571 wl_display_roundtrip( wldisp );
572 s_wl_confined_pointer = NULL;
573 }
574
575 s_wl_locked_flag = false;
576
577 s_wl_locked_pointer =
578 zwp_pointer_constraints_v1_lock_pointer( s_wl_pointer_constraints, wlsurf, wlptr, NULL,
580
581 zwp_locked_pointer_v1_add_listener(s_wl_locked_pointer, &locked_pointer_listener, NULL);
582
583 gint wx, wy;
584 gtk_widget_translate_coordinates( aWidget, gtk_widget_get_toplevel( aWidget ), 0, 0, &wx, &wy );
585
586 zwp_locked_pointer_v1_set_cursor_position_hint( s_wl_locked_pointer, wl_fixed_from_int( aX + wx ),
587 wl_fixed_from_int( aY + wy ) );
588
589 // Don't call wl_surface_commit, wait for GDK because of an assert on GNOME.
590 wl_display_roundtrip( wldisp ); // To receive "locked" event.
591 gtk_widget_queue_draw( aWidget ); // Needed on some GNOME environment to trigger
592 // the "after-paint" event handler.
593
594 return s_wl_locked_flag;
595}
596
597
598bool KIPLATFORM::UI::InfiniteDragPrepareWindow( wxWindow* aWindow )
599{
600 wxLogTrace( traceWayland, wxS( "InfiniteDragPrepareWindow" ) );
601
602 GtkWidget* widget = static_cast<GtkWidget*>( aWindow->GetHandle() );
603 GdkDisplay* disp = gtk_widget_get_display( widget );
604
605 if( GDK_IS_WAYLAND_DISPLAY( disp ) )
606 {
607 if( s_wl_confined_pointer != NULL )
608 {
610 }
611
612 GdkSeat* seat = gdk_display_get_default_seat( disp );
613 GdkDevice* ptrdev = gdk_seat_get_pointer( seat );
614 GdkWindow* win = aWindow->GTKGetDrawingWindow();
615
616 wl_display* wldisp = gdk_wayland_display_get_wl_display( disp );
617 wl_surface* wlsurf = gdk_wayland_window_get_wl_surface( win );
618 wl_pointer* wlptr = gdk_wayland_device_get_wl_pointer( ptrdev );
619
620 initialize_wayland( wldisp );
621
622 gint x, y, width, height;
623 gdk_window_get_geometry( gdk_window_get_toplevel( win ), &x, &y, &width, &height );
624
625 wxLogTrace( traceWayland, wxS( "Confine region: %d %d %d %d" ), x, y, width, height );
626
627 s_wl_confinement_region = wl_compositor_create_region( s_wl_compositor );
628 wl_region_add( s_wl_confinement_region, x, y, width, height );
629
630 s_wl_confined_pointer = zwp_pointer_constraints_v1_confine_pointer(
631 s_wl_pointer_constraints, wlsurf, wlptr, s_wl_confinement_region,
633
634 zwp_confined_pointer_v1_add_listener( s_wl_confined_pointer, &confined_pointer_listener,
635 NULL );
636
637 wl_display_roundtrip( wldisp );
638 }
639 else if( wxGetEnv( wxT( "WAYLAND_DISPLAY" ), nullptr ) )
640 {
641 // Not working under XWayland
642 return false;
643 }
644
645 return true;
646};
647
648
650{
651 wxLogTrace( traceWayland, wxS( "InfiniteDragReleaseWindow" ) );
652
653 if( s_wl_confined_pointer )
654 {
655 zwp_confined_pointer_v1_destroy( s_wl_confined_pointer );
656 s_wl_confined_pointer = NULL;
657 }
658
659 if( s_wl_confinement_region )
660 {
661 wl_region_destroy( s_wl_confinement_region );
662 s_wl_confinement_region = NULL;
663 }
664};
665
666
667#else // No Wayland support
668
669
671{
672 // Not working under XWayland
673 return !wxGetEnv( wxT( "WAYLAND_DISPLAY" ), nullptr );
674};
675
676
678{
679 // Not needed on X11
680};
681
682
684{
685 return wxGetMousePosition();
686}
687#endif
const char * name
Definition: DXF_plotter.cpp:62
static void zwp_confined_pointer_v1_destroy(struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1)
Destroy the confined pointer object.
static int zwp_confined_pointer_v1_add_listener(struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1, const struct zwp_confined_pointer_v1_listener *listener, void *data)
static void zwp_locked_pointer_v1_set_cursor_position_hint(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1, wl_fixed_t surface_x, wl_fixed_t surface_y)
Set the cursor position hint relative to the top left corner of the surface.
static int zwp_locked_pointer_v1_add_listener(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1, const struct zwp_locked_pointer_v1_listener *listener, void *data)
static void zwp_locked_pointer_v1_destroy(struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1)
Destroy the locked pointer object.
static struct zwp_locked_pointer_v1 * zwp_pointer_constraints_v1_lock_pointer(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, struct wl_surface *surface, struct wl_pointer *pointer, struct wl_region *region, uint32_t lifetime)
The lock_pointer request lets the client request to disable movements of the virtual pointer (i....
static struct zwp_confined_pointer_v1 * zwp_pointer_constraints_v1_confine_pointer(struct zwp_pointer_constraints_v1 *zwp_pointer_constraints_v1, struct wl_surface *surface, struct wl_pointer *pointer, struct wl_region *region, uint32_t lifetime)
The confine_pointer request lets the client request to confine the pointer cursor to a given region.
@ ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT
the pointer constraint is defunct once deactivated
bool AllowIconsInMenus()
If the user has disabled icons system-wide, we check that here.
Definition: wxgtk/ui.cpp:272
void SetFloatLevel(wxWindow *aWindow)
Intended to set the floating window level in macOS on a window.
Definition: wxgtk/ui.cpp:401
void GetInfoBarColours(wxColour &aFGColour, wxColour &aBGColour)
Return the background and foreground colors for info bars in the current scheme.
Definition: wxgtk/ui.cpp:67
void EllipsizeChoiceBox(wxChoice *aChoice)
Configure a wxChoice control to ellipsize the shown text in the button with the ellipses placed at th...
Definition: wxgtk/ui.cpp:217
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: wxgtk/ui.cpp:157
void SetOverlayScrolling(const wxWindow *aWindow, bool overlay)
Used to set overlay/non-overlay scrolling mode in a window.
Definition: wxgtk/ui.cpp:265
wxPoint GetMousePosition()
Returns the mouse position in screen coordinates.
Definition: wxgtk/ui.cpp:683
void ImmControl(wxWindow *aWindow, bool aEnable)
Configures the IME mode of a given control handle.
Definition: wxgtk/ui.cpp:382
double GetPixelScaleFactor(const wxWindow *aWindow)
Tries to determine the pixel scaling factor currently in use for the window.
Definition: wxgtk/ui.cpp:238
void InfiniteDragReleaseWindow()
On Wayland, allows the cursor to freely move again after a drag (see InfiniteDragPrepareWindow).
Definition: wxgtk/ui.cpp:677
void EnsureVisible(wxWindow *aWindow)
Ensure that a window is visible on the screen.
Definition: wxgtk/ui.cpp:145
bool IsStockCursorOk(wxStockCursor aCursor)
Checks if we designated a stock cursor for this OS as "OK" or else we may need to load a custom one.
Definition: wxgtk/ui.cpp:163
double GetContentScaleFactor(const wxWindow *aWindow)
Tries to determine the content scaling factor currently in use for the window.
Definition: wxgtk/ui.cpp:251
void ImeNotifyCancelComposition(wxWindow *aWindow)
Asks the IME to cancel.
Definition: wxgtk/ui.cpp:387
void LargeChoiceBoxHack(wxChoice *aChoice)
Configure a wxChoice control to support a lot of entries by disabling functionality that makes adding...
Definition: wxgtk/ui.cpp:199
bool WarpPointer(wxWindow *aWindow, int aX, int aY)
Move the mouse cursor to a specific position relative to the window.
Definition: wxgtk/ui.cpp:316
wxColour GetDialogBGColour()
Definition: wxgtk/ui.cpp:61
bool IsWindowActive(wxWindow *aWindow)
Check to see if the given window is the currently active window (e.g.
Definition: wxgtk/ui.cpp:130
wxSize GetUnobscuredSize(const wxWindow *aWindow)
Tries to determine the size of the viewport of a scrollable widget (wxDataViewCtrl,...
Definition: wxgtk/ui.cpp:258
void ForceFocus(wxWindow *aWindow)
Pass the current focus to the window.
Definition: wxgtk/ui.cpp:124
bool InfiniteDragPrepareWindow(wxWindow *aWindow)
On Wayland, restricts the pointer movement to a rectangle slightly bigger than the given wxWindow.
Definition: wxgtk/ui.cpp:670
void ReparentModal(wxNonOwnedWindow *aWindow)
Move a window's parent to be the top-level window and force the window to be on top.
Definition: wxgtk/ui.cpp:151
bool IsDarkTheme()
Determine if the desktop interface is currently using a dark theme or a light theme.
Definition: wxgtk/ui.cpp:48
std::shared_ptr< PNS_LOG_VIEWER_OVERLAY > overlay
Definition: playground.cpp:46
void(* confined)(void *data, struct zwp_confined_pointer_v1 *zwp_confined_pointer_v1)
pointer confined
void(* locked)(void *data, struct zwp_locked_pointer_v1 *zwp_locked_pointer_v1)
lock activation event
const struct wl_interface zwp_pointer_constraints_v1_interface
static void disable_area_apply_attributes_cb(GtkWidget *pItem, gpointer userdata)
The following two functions are based on the "hack" contained in the attached patch at https://gitlab...
Definition: wxgtk/ui.cpp:186
const wxString traceWayland
Definition: wxgtk/ui.cpp:45