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