From: Thomas Debesse Date: Tue, 21 Jun 2022 02:21:38 +0000 (+0200) Subject: Merge commit '020d0244e4239b21dc804d630edff926386ea34f' into master-merge X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fnetradiant.git;a=commitdiff_plain;h=8c4e2fcb9c77360f0918be91642777f91fc99e53 Merge commit '020d0244e4239b21dc804d630edff926386ea34f' into master-merge --- 8c4e2fcb9c77360f0918be91642777f91fc99e53 diff --cc libs/gtkutil/cursor.cpp index b2e1e53e,8f387220..445fb183 --- a/libs/gtkutil/cursor.cpp +++ b/libs/gtkutil/cursor.cpp @@@ -234,18 -105,12 +234,18 @@@ void FreezePointer::freeze_pointer(ui:: //gdk_window_set_cursor ( GTK_WIDGET( window )->window, cursor ); /* is needed to fix activating neighbour widgets, that happens, if using upper one */ gtk_grab_add( widget ); - weedjet = widget; + m_weedjet = widget; - +#else + GdkCursor* cursor = create_blank_cursor(); + //GdkGrabStatus status = + gdk_pointer_grab( gtk_widget_get_window( widget ), TRUE, mask, 0, cursor, GDK_CURRENT_TIME ); gdk_cursor_unref( cursor ); +#endif +#endif - Sys_GetCursorPos( window, &recorded_x, &recorded_y ); + Sys_GetCursorPos( widget, &recorded_x, &recorded_y ); +#if 0 // NetRadiantCustom /* using center for tracking for max safety */ gdk_window_get_origin( GTK_WIDGET( widget )->window, ¢er_x, ¢er_y ); auto allocation = widget.dimensions(); @@@ -264,31 -125,28 +264,41 @@@ m_function = function; m_data = data; - handle_motion = window.connect( "motion_notify_event", G_CALLBACK( motion_delta ), this ); + handle_motion = widget.connect( "motion_notify_event", G_CALLBACK( motion_delta ), this ); } - void FreezePointer::unfreeze_pointer(ui::Widget widget) -void FreezePointer::unfreeze_pointer(ui::Window window, bool centerize ) ++// Only NetRadiantCustom uses centerize code. ++void FreezePointer::unfreeze_pointer(ui::Widget widget, bool centerize) { - g_signal_handler_disconnect( G_OBJECT( window ), handle_motion ); + g_signal_handler_disconnect( G_OBJECT( widget ), handle_motion ); m_function = 0; m_data = 0; +#if defined(WORKAROUND_MACOS_GTK2_LAGGYPOINTER) + /* The pointer was visible during all the move operation, + so, keep the current position. */ +#else + // NetRadiantCustom still uses window instead of widget. +#if 0 // NetRadiantCustom - Sys_SetCursorPos( window, recorded_x, recorded_y ); + if ( centerize ){ + Sys_SetCursorPos( window, center_x, center_y ); + } + else{ + Sys_SetCursorPos( window, recorded_x, recorded_y ); + } +#else + Sys_SetCursorPos( widget, recorded_x, recorded_y ); +#endif +#endif // gdk_window_set_cursor( GTK_WIDGET( window )->window, 0 ); gdk_pointer_ungrab( GDK_CURRENT_TIME ); + +#if 0 // NetRadiantCustom - gtk_grab_remove( weedjet ); + if ( m_weedjet ) + { + gtk_grab_remove( m_weedjet ); + } +#endif } diff --cc libs/gtkutil/cursor.h index f7a66a37,89c6f72b..0a19fab1 --- a/libs/gtkutil/cursor.h +++ b/libs/gtkutil/cursor.h @@@ -22,7 -22,6 +22,8 @@@ #if !defined( INCLUDED_GTKUTIL_CURSOR_H ) #define INCLUDED_GTKUTIL_CURSOR_H ++// This is probably removable if set_cursor is not used. +#include #include #include "debugging/debugging.h" @@@ -118,17 -117,11 +119,17 @@@ void* m_data public: FreezePointer() : handle_motion( 0 ), m_function( 0 ), m_data( 0 ){ } -static gboolean motion_delta( ui::Window widget, GdkEventMotion *event, FreezePointer* self ); +/* NetRadiantCustom does this instead: +static gboolean motion_delta( ui::Window widget, GdkEventMotion *event, FreezePointer* self ); */ +static gboolean motion_delta( ui::Widget widget, GdkEventMotion *event, FreezePointer* self ); -void freeze_pointer( ui::Window window, ui::Widget widget, MotionDeltaFunction function, void* data ); +/* NetRadiantCustom does this instead: +void freeze_pointer( ui::Window window, ui::Widget widget, MotionDeltaFunction function, void* data ); */ +void freeze_pointer( ui::Widget widget, MotionDeltaFunction function, void* data ); -void unfreeze_pointer( ui::Window window, bool centerize ); +/* NetRadiantCustom does this instead: - void unfreeze_pointer( ui::Window window ); */ - void unfreeze_pointer( ui::Widget widget ); ++void unfreeze_pointer( ui::Window window, bool centerize ); */ ++void unfreeze_pointer( ui::Widget widget, bool centerize ); }; #endif diff --cc radiant/camwindow.cpp index accdb30a,e08458eb..9f6beb1a --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@@ -1344,7 -1337,7 +1344,8 @@@ void CamWnd::DisableFreeMove() CamWnd_Remove_Handlers_FreeMove( *this ); CamWnd_Add_Handlers_Move( *this ); - m_freezePointer.unfreeze_pointer( m_gl_widget ); - m_freezePointer.unfreeze_pointer( m_parent, true ); ++ m_freezePointer.unfreeze_pointer( m_gl_widget, true ); ++ g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_freemove_handle_focusout ); CamWnd_Update( *this ); diff --cc radiant/texwindow.cpp index 34a31b1e,24090155..7670d20c --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@@ -1176,10 -1123,7 +1176,9 @@@ void TextureBrowser_trackingDelta( int void TextureBrowser_Tracking_MouseUp( TextureBrowser& textureBrowser ){ textureBrowser.m_move_started = false; - textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_parent, false ); + /* NetRadiantCustom did this instead: - textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget ); */ - - textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget ); ++ textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_parent, false ); */ ++ textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget, false ); } void TextureBrowser_Tracking_MouseDown( TextureBrowser& textureBrowser ){ diff --cc radiant/xywindow.cpp index db3802bd,1a176bfd..e2a2d506 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@@ -1236,7 -1245,7 +1252,9 @@@ void XYWnd::Move_Begin() void XYWnd::Move_End(){ m_move_started = false; - g_xywnd_freezePointer.unfreeze_pointer( m_gl_widget ); - g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), false ); ++ /* NetRadiant did this instead: ++ g_xywnd_freezePointer.unfreeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), false ); */ ++ g_xywnd_freezePointer.unfreeze_pointer( m_gl_widget, false ); g_signal_handler_disconnect( G_OBJECT( m_gl_widget ), m_move_focusOut ); } @@@ -2187,13 -2193,11 +2212,13 @@@ void XYWnd::updateProjection( bool reco m_projection[15] = 1.0f; + if (reconstruct) { - m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight ); - } + m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight ); + } +} // note: modelview matrix must have a uniform scale, otherwise strange things happen when rendering the rotation manipulator. -void XYWnd::updateModelview(){ +void XYWnd::updateModelview( bool reconstruct ){ int nDim1 = ( m_viewType == YZ ) ? 1 : 0; int nDim2 = ( m_viewType == XY ) ? 1 : 2; @@@ -2249,9 -2253,7 +2274,9 @@@ m_modelview[3] = m_modelview[7] = m_modelview[11] = 0; m_modelview[15] = 1; + if (reconstruct) { - m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight ); + m_view.Construct( m_projection, m_modelview, m_nWidth, m_nHeight ); + } } /*