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
157void KIPLATFORM::UI::ReparentWindow( wxNonOwnedWindow* aWindow, wxTopLevelWindow* aParent )
158{
159 // Not needed on this platform (only relevant for macOS child window ordering)
160}
161
162
164{
165 // Not needed on this platform
166}
167
168
169bool KIPLATFORM::UI::IsStockCursorOk( wxStockCursor aCursor )
170{
171 switch( aCursor )
172 {
173 case wxCURSOR_BULLSEYE:
174 case wxCURSOR_HAND:
175 case wxCURSOR_ARROW:
176 case wxCURSOR_BLANK:
177 return true;
178 default:
179 return false;
180 }
181}
182
183
192static void disable_area_apply_attributes_cb( GtkWidget* pItem, gpointer userdata )
193{
194 // GTK needs this enormous chain to get the actual type of item that we want
195 GtkMenuItem* pMenuItem = GTK_MENU_ITEM( pItem );
196 GtkWidget* child = gtk_bin_get_child( GTK_BIN( pMenuItem ) );
197 GtkCellView* pCellView = GTK_CELL_VIEW( child );
198 GtkCellLayout* pCellLayout = GTK_CELL_LAYOUT( pCellView );
199 GtkCellArea* pCellArea = gtk_cell_layout_get_area( pCellLayout );
200
201 g_signal_handlers_block_matched( pCellArea, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, userdata );
202}
203
204
205void KIPLATFORM::UI::LargeChoiceBoxHack( wxChoice* aChoice )
206{
207 AtkObject* atkObj = gtk_combo_box_get_popup_accessible( GTK_COMBO_BOX( aChoice->m_widget ) );
208
209 if( !atkObj || !GTK_IS_ACCESSIBLE( atkObj ) )
210 return;
211
212 GtkWidget* widget = gtk_accessible_get_widget( GTK_ACCESSIBLE( atkObj ) );
213
214 if( !widget || !GTK_IS_MENU( widget ) )
215 return;
216
217 GtkMenu* menu = GTK_MENU( widget );
218
219 gtk_container_foreach( GTK_CONTAINER( menu ), disable_area_apply_attributes_cb, menu );
220}
221
222
223void KIPLATFORM::UI::EllipsizeChoiceBox( wxChoice* aChoice )
224{
225 // This function is based on the code inside the function post_process_ui in
226 // gtkfilechooserwidget.c
227 GList* cells = gtk_cell_layout_get_cells( GTK_CELL_LAYOUT( aChoice->m_widget ) );
228
229 if( !cells )
230 return;
231
232 GtkCellRenderer* cell = (GtkCellRenderer*) cells->data;
233
234 if( !cell )
235 return;
236
237 g_object_set( G_OBJECT( cell ), "ellipsize", PANGO_ELLIPSIZE_END, nullptr );
238
239 // Only the list of cells must be freed, the renderer isn't ours to free
240 g_list_free( cells );
241}
242
243
244double KIPLATFORM::UI::GetPixelScaleFactor( const wxWindow* aWindow )
245{
246 double val = 1.0;
247
248 GtkWidget* widget = static_cast<GtkWidget*>( aWindow->GetHandle() );
249
250 if( widget && gtk_check_version( 3, 10, 0 ) == nullptr )
251 val = gtk_widget_get_scale_factor( widget );
252
253 return val;
254}
255
256
257double KIPLATFORM::UI::GetContentScaleFactor( const wxWindow* aWindow )
258{
259 // TODO: Do we need something different here?
260 return GetPixelScaleFactor( aWindow );
261}
262
263
264wxSize KIPLATFORM::UI::GetUnobscuredSize( const wxWindow* aWindow )
265{
266 return wxSize( aWindow->GetSize().GetX() - wxSystemSettings::GetMetric( wxSYS_VSCROLL_X ),
267 aWindow->GetSize().GetY() - wxSystemSettings::GetMetric( wxSYS_HSCROLL_Y ) );
268}
269
270
271void KIPLATFORM::UI::SetOverlayScrolling( const wxWindow* aWindow, bool overlay )
272{
273 gtk_scrolled_window_set_overlay_scrolling( GTK_SCROLLED_WINDOW( aWindow->GetHandle() ),
274 overlay );
275}
276
277
279{
280 gboolean allowed = 1;
281
282 g_object_get( gtk_settings_get_default(), "gtk-menu-images", &allowed, NULL );
283
284 return !!allowed;
285}
286
287
288#if defined( GDK_WINDOWING_WAYLAND ) && defined( KICAD_WAYLAND )
289
290static bool wayland_warp_pointer( GtkWidget* aWidget, GdkDisplay* aDisplay, GdkWindow* aWindow,
291 GdkDevice* aPtrDev, int aX, int aY );
292
293// GDK doesn't know if we've moved the cursor using Wayland pointer constraints.
294// So emulate the actual position here
295static wxPoint s_warped_from;
296static wxPoint s_warped_to;
297
299{
300 wxPoint wx_pos = wxGetMousePosition();
301
302 if( wx_pos == s_warped_from )
303 {
304 wxLogTrace( traceWayland, wxS( "Faked mouse pos %d %d -> %d %d" ), wx_pos.x, wx_pos.y,
305 s_warped_to.x, s_warped_to.y );
306
307 return s_warped_to;
308 }
309 else
310 {
311 // Mouse has moved
312 s_warped_from = wxPoint();
313 s_warped_to = wxPoint();
314 }
315
316 return wx_pos;
317}
318
319#endif
320
321
322bool KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
323{
324 if( !wxGetEnv( wxT( "WAYLAND_DISPLAY" ), nullptr ) )
325 {
326 aWindow->WarpPointer( aX, aY );
327 return true;
328 }
329 else
330 {
331 GtkWidget* widget = static_cast<GtkWidget*>( aWindow->GetHandle() );
332
333 GdkDisplay* disp = gtk_widget_get_display( widget );
334 GdkSeat* seat = gdk_display_get_default_seat( disp );
335 GdkDevice* ptrdev = gdk_seat_get_pointer( seat );
336
337#if defined( GDK_WINDOWING_WAYLAND ) && defined( KICAD_WAYLAND )
338 if( GDK_IS_WAYLAND_DISPLAY( disp ) )
339 {
340 wxPoint initialPos = wxGetMousePosition();
341 GdkWindow* win = aWindow->GTKGetDrawingWindow();
342
343 if( wayland_warp_pointer( widget, disp, win, ptrdev, aX, aY ) )
344 {
345 s_warped_from = initialPos;
346 s_warped_to = aWindow->ClientToScreen( wxPoint( aX, aY ) );
347
348 wxLogTrace( traceWayland, wxS( "Set warped from %d %d to %d %d" ), s_warped_from.x,
349 s_warped_from.y, s_warped_to.x, s_warped_to.y );
350
351 return true;
352 }
353
354 wxLogTrace( traceWayland, wxS( "*** Warp to %d %d failed ***" ), aX, aY );
355
356 return false;
357 }
358#endif
359#ifdef GDK_WINDOWING_X11
360 if( GDK_IS_X11_DISPLAY( disp ) )
361 {
362 GdkWindow* win = gdk_device_get_window_at_position( ptrdev, nullptr, nullptr );
363 GdkCursor* blank_cursor = gdk_cursor_new_for_display( disp, GDK_BLANK_CURSOR );
364 GdkCursor* cur_cursor = gdk_window_get_cursor( win );
365
366 if( cur_cursor )
367 g_object_ref( cur_cursor );
368
369 gdk_window_set_cursor( win, blank_cursor );
370 aWindow->WarpPointer( aX, aY );
371 gdk_window_set_cursor( win, cur_cursor );
372
373 if( cur_cursor )
374 g_object_unref( cur_cursor );
375
376 if( blank_cursor )
377 g_object_unref( blank_cursor );
378
379 return true;
380 }
381#endif
382 }
383
384 return false;
385}
386
387
388void KIPLATFORM::UI::ImmControl( wxWindow* aWindow, bool aEnable )
389{
390}
391
392
394{
395 wxWindowGTK* win = static_cast<wxWindowGTK*>( aWindow );
396 if( win )
397 {
398 GtkIMContext* imContext = win->m_imContext;
399 if( imContext )
400 {
401 gtk_im_context_focus_out( imContext );
402 }
403 }
404}
405
406
407void KIPLATFORM::UI::SetFloatLevel( wxWindow* aWindow )
408{
409}
410
411//
412// **** Wayland hacks ahead ****
413//
414
415#if defined( GDK_WINDOWING_WAYLAND ) && defined( KICAD_WAYLAND )
416
417static bool s_wl_initialized = false;
418static struct wl_compositor* s_wl_compositor = NULL;
419static struct zwp_pointer_constraints_v1* s_wl_pointer_constraints = NULL;
420static struct zwp_confined_pointer_v1* s_wl_confined_pointer = NULL;
421static struct wl_region* s_wl_confinement_region = NULL;
422static bool s_wl_locked_flag = false;
423
424static void handle_global( void* data, struct wl_registry* registry, uint32_t name,
425 const char* interface, uint32_t version )
426{
427 wxLogTrace( traceWayland, "handle_global received %s name %u version %u", interface,
428 (unsigned int) name, (unsigned int) version );
429
430 if( strcmp( interface, wl_compositor_interface.name ) == 0 )
431 {
432 s_wl_compositor = static_cast<wl_compositor*>(
433 wl_registry_bind( registry, name, &wl_compositor_interface, version ) );
434 }
435 else if( strcmp( interface, zwp_pointer_constraints_v1_interface.name ) == 0 )
436 {
437 s_wl_pointer_constraints = static_cast<zwp_pointer_constraints_v1*>( wl_registry_bind(
438 registry, name, &zwp_pointer_constraints_v1_interface, version ) );
439 }
440}
441
442static void handle_global_remove( void*, struct wl_registry*, uint32_t name )
443{
444 wxLogTrace( traceWayland, "handle_global_remove name %u", (unsigned int) name );
445}
446
447static const struct wl_registry_listener registry_listener = {
448 .global = handle_global,
449 .global_remove = handle_global_remove,
450};
451
452static void confined_handler( void* data, struct zwp_confined_pointer_v1* zwp_confined_pointer_v1 )
453{
454 wxLogTrace( traceWayland, wxS( "Pointer confined" ) );
455}
456
457static void unconfined_handler( void* data,
458 struct zwp_confined_pointer_v1* zwp_confined_pointer_v1 )
459{
460 wxLogTrace( traceWayland, wxS( "Pointer unconfined" ) );
461}
462
463static const struct zwp_confined_pointer_v1_listener confined_pointer_listener = {
464 .confined = confined_handler,
465 .unconfined = unconfined_handler
466};
467
468static void locked_handler( void* data, struct zwp_locked_pointer_v1* zwp_locked_pointer_v1 )
469{
470 s_wl_locked_flag = true;
471 wxLogTrace( traceWayland, wxS( "Pointer locked" ) );
472}
473
474static void unlocked_handler( void* data, struct zwp_locked_pointer_v1* zwp_locked_pointer_v1 )
475{
476 wxLogTrace( traceWayland, wxS( "Pointer unlocked" ) );
477}
478
479static const struct zwp_locked_pointer_v1_listener locked_pointer_listener = {
480 .locked = locked_handler,
481 .unlocked = unlocked_handler
482};
483
484
488static void initialize_wayland( wl_display* wldisp )
489{
490 if( s_wl_initialized )
491 {
492 return;
493 }
494
495 struct wl_registry* registry = wl_display_get_registry( wldisp );
496 wl_registry_add_listener( registry, &registry_listener, NULL );
497 wl_display_roundtrip( wldisp );
498 s_wl_initialized = true;
499}
500
501
502struct zwp_locked_pointer_v1* s_wl_locked_pointer = NULL;
503
504static int s_after_paint_handler_id = 0;
505
506static void on_frame_clock_after_paint( GdkFrameClock* clock, GtkWidget* widget )
507{
508 if( s_wl_locked_pointer )
509 {
510 zwp_locked_pointer_v1_destroy( s_wl_locked_pointer );
511 s_wl_locked_pointer = NULL;
512
513 wxLogTrace( traceWayland, wxS( "after-paint: locked_pointer destroyed" ) );
514
515 g_signal_handler_disconnect( (gpointer) clock, s_after_paint_handler_id );
516 s_after_paint_handler_id = 0;
517
518 // restore confinement
519 if( s_wl_confinement_region != NULL )
520 {
521 wxLogTrace( traceWayland, wxS( "after-paint: Restoring confinement" ) );
522
523 GdkDisplay* disp = gtk_widget_get_display( widget );
524 GdkSeat* seat = gdk_display_get_default_seat( disp );
525 GdkDevice* ptrdev = gdk_seat_get_pointer( seat );
526 GdkWindow* window = gtk_widget_get_window( widget );
527
528 wl_display* wldisp = gdk_wayland_display_get_wl_display( disp );
529 wl_surface* wlsurf = gdk_wayland_window_get_wl_surface( window );
530 wl_pointer* wlptr = gdk_wayland_device_get_wl_pointer( ptrdev );
531
532 s_wl_confined_pointer = zwp_pointer_constraints_v1_confine_pointer(
533 s_wl_pointer_constraints, wlsurf, wlptr, s_wl_confinement_region,
535
536 wl_display_roundtrip( wldisp );
537 }
538 }
539}
540
541
542static bool wayland_warp_pointer( GtkWidget* aWidget, GdkDisplay* aDisplay, GdkWindow* aWindow,
543 GdkDevice* aPtrDev, int aX, int aY )
544{
545 wl_display* wldisp = gdk_wayland_display_get_wl_display( aDisplay );
546 wl_surface* wlsurf = gdk_wayland_window_get_wl_surface( aWindow );
547 wl_pointer* wlptr = gdk_wayland_device_get_wl_pointer( aPtrDev );
548
549 if( s_after_paint_handler_id )
550 {
551 // Previous paint not done yet
552 wxLogTrace( traceWayland, wxS( "Not warping: after-paint pending" ) );
553 return false;
554 }
555
556 initialize_wayland( wldisp );
557
558 if( s_wl_locked_pointer )
559 {
560 // This shouldn't happen but let's be safe
561 wxLogTrace( traceWayland, wxS( "** Destroying previous locked_pointer **" ) );
562 zwp_locked_pointer_v1_destroy( s_wl_locked_pointer );
563 wl_display_roundtrip( wldisp );
564 s_wl_locked_pointer = NULL;
565 }
566
567 // wl_surface_commit causes an assert on GNOME, but has to be called on KDE
568 // before destroying the locked pointer, so wait until GDK commits the surface.
569 GdkFrameClock* frame_clock = gdk_window_get_frame_clock( aWindow );
570 s_after_paint_handler_id = g_signal_connect_after(
571 frame_clock, "after-paint", G_CALLBACK( on_frame_clock_after_paint ), aWidget );
572
573 // temporary disable confinement to allow pointer warping
574 if( s_wl_confinement_region && s_wl_confined_pointer )
575 {
576 zwp_confined_pointer_v1_destroy( s_wl_confined_pointer );
577 wl_display_roundtrip( wldisp );
578 s_wl_confined_pointer = NULL;
579 }
580
581 s_wl_locked_flag = false;
582
583 s_wl_locked_pointer =
584 zwp_pointer_constraints_v1_lock_pointer( s_wl_pointer_constraints, wlsurf, wlptr, NULL,
586
587 zwp_locked_pointer_v1_add_listener(s_wl_locked_pointer, &locked_pointer_listener, NULL);
588
589 gint wx, wy;
590 gtk_widget_translate_coordinates( aWidget, gtk_widget_get_toplevel( aWidget ), 0, 0, &wx, &wy );
591
592 zwp_locked_pointer_v1_set_cursor_position_hint( s_wl_locked_pointer, wl_fixed_from_int( aX + wx ),
593 wl_fixed_from_int( aY + wy ) );
594
595 // Don't call wl_surface_commit, wait for GDK because of an assert on GNOME.
596 wl_display_roundtrip( wldisp ); // To receive "locked" event.
597 gtk_widget_queue_draw( aWidget ); // Needed on some GNOME environment to trigger
598 // the "after-paint" event handler.
599
600 return s_wl_locked_flag;
601}
602
603
604bool KIPLATFORM::UI::InfiniteDragPrepareWindow( wxWindow* aWindow )
605{
606 wxLogTrace( traceWayland, wxS( "InfiniteDragPrepareWindow" ) );
607
608 GtkWidget* widget = static_cast<GtkWidget*>( aWindow->GetHandle() );
609 GdkDisplay* disp = gtk_widget_get_display( widget );
610
611 if( GDK_IS_WAYLAND_DISPLAY( disp ) )
612 {
613 if( s_wl_confined_pointer != NULL )
614 {
616 }
617
618 GdkSeat* seat = gdk_display_get_default_seat( disp );
619 GdkDevice* ptrdev = gdk_seat_get_pointer( seat );
620 GdkWindow* win = aWindow->GTKGetDrawingWindow();
621
622 wl_display* wldisp = gdk_wayland_display_get_wl_display( disp );
623 wl_surface* wlsurf = gdk_wayland_window_get_wl_surface( win );
624 wl_pointer* wlptr = gdk_wayland_device_get_wl_pointer( ptrdev );
625
626 initialize_wayland( wldisp );
627
628 gint x, y, width, height;
629 gdk_window_get_geometry( gdk_window_get_toplevel( win ), &x, &y, &width, &height );
630
631 wxLogTrace( traceWayland, wxS( "Confine region: %d %d %d %d" ), x, y, width, height );
632
633 s_wl_confinement_region = wl_compositor_create_region( s_wl_compositor );
634 wl_region_add( s_wl_confinement_region, x, y, width, height );
635
636 s_wl_confined_pointer = zwp_pointer_constraints_v1_confine_pointer(
637 s_wl_pointer_constraints, wlsurf, wlptr, s_wl_confinement_region,
639
640 zwp_confined_pointer_v1_add_listener( s_wl_confined_pointer, &confined_pointer_listener,
641 NULL );
642
643 wl_display_roundtrip( wldisp );
644 }
645 else if( wxGetEnv( wxT( "WAYLAND_DISPLAY" ), nullptr ) )
646 {
647 // Not working under XWayland
648 return false;
649 }
650
651 return true;
652};
653
654
656{
657 wxLogTrace( traceWayland, wxS( "InfiniteDragReleaseWindow" ) );
658
659 if( s_wl_confined_pointer )
660 {
661 zwp_confined_pointer_v1_destroy( s_wl_confined_pointer );
662 s_wl_confined_pointer = NULL;
663 }
664
665 if( s_wl_confinement_region )
666 {
667 wl_region_destroy( s_wl_confinement_region );
668 s_wl_confinement_region = NULL;
669 }
670};
671
672
673#else // No Wayland support
674
675
677{
678 // Not working under XWayland
679 return !wxGetEnv( wxT( "WAYLAND_DISPLAY" ), nullptr );
680};
681
682
684{
685 // Not needed on X11
686};
687
688
690{
691 return wxGetMousePosition();
692}
693#endif
const char * name
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:278
void SetFloatLevel(wxWindow *aWindow)
Intended to set the floating window level in macOS on a window.
Definition wxgtk/ui.cpp:407
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 ReparentWindow(wxNonOwnedWindow *aWindow, wxTopLevelWindow *aParent)
Definition wxgtk/ui.cpp:157
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:223
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition wxgtk/ui.cpp:163
void SetOverlayScrolling(const wxWindow *aWindow, bool overlay)
Used to set overlay/non-overlay scrolling mode in a window.
Definition wxgtk/ui.cpp:271
wxPoint GetMousePosition()
Returns the mouse position in screen coordinates.
Definition wxgtk/ui.cpp:689
void ImmControl(wxWindow *aWindow, bool aEnable)
Configures the IME mode of a given control handle.
Definition wxgtk/ui.cpp:388
double GetPixelScaleFactor(const wxWindow *aWindow)
Tries to determine the pixel scaling factor currently in use for the window.
Definition wxgtk/ui.cpp:244
void InfiniteDragReleaseWindow()
On Wayland, allows the cursor to freely move again after a drag (see InfiniteDragPrepareWindow).
Definition wxgtk/ui.cpp:683
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:169
double GetContentScaleFactor(const wxWindow *aWindow)
Tries to determine the content scaling factor currently in use for the window.
Definition wxgtk/ui.cpp:257
void ImeNotifyCancelComposition(wxWindow *aWindow)
Asks the IME to cancel.
Definition wxgtk/ui.cpp:393
void LargeChoiceBoxHack(wxChoice *aChoice)
Configure a wxChoice control to support a lot of entries by disabling functionality that makes adding...
Definition wxgtk/ui.cpp:205
bool WarpPointer(wxWindow *aWindow, int aX, int aY)
Move the mouse cursor to a specific position relative to the window.
Definition wxgtk/ui.cpp:322
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:264
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:676
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
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:192
const wxString traceWayland
Definition wxgtk/ui.cpp:45