]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit '01a950c3de3ef7f7da23360f925404e2bd385d5d' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 00:17:20 +0000 (02:17 +0200)
committerThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 00:17:20 +0000 (02:17 +0200)
libs/gtkutil/cursor.cpp
libs/gtkutil/cursor.h
radiant/camwindow.cpp
radiant/gtkdlgs.cpp
radiant/mainframe.cpp
radiant/texwindow.cpp
radiant/xywindow.cpp

index fd11c7799844b2600ae79e033a670612597a6ec1..a58c6cf09af054a233a07309cc8c168f9257531b 100644 (file)
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
+// Note: NetRadiantCustom disables them but we still make use of them.
+#if 1
 GdkCursor* create_blank_cursor(){
-       return gdk_cursor_new( GDK_BLANK_CURSOR );
+       return gdk_cursor_new(GDK_BLANK_CURSOR);
 }
 
 void set_cursor( ui::Widget widget, GdkCursorType cursor_type ){
        GdkCursor* cursor = gdk_cursor_new( cursor_type );
-       gdk_window_set_cursor( gtk_widget_get_window( widget ), cursor );
+       gdk_window_set_cursor( gtk_widget_get_window(widget), cursor );
        gdk_cursor_unref( cursor );
 }
 
@@ -44,6 +46,7 @@ void blank_cursor( ui::Widget widget ){
 void default_cursor( ui::Widget widget ){
        gdk_window_set_cursor( gtk_widget_get_window( widget ), NULL );
 }
+#endif
 
 void Sys_GetCursorPos( ui::Widget widget, int *x, int *y ){
        GdkDisplay *display = gtk_widget_get_display( GTK_WIDGET( widget ) );
@@ -218,6 +221,7 @@ void FreezePointer::unfreeze_pointer(ui::Widget widget)
        /* The pointer was visible during all the move operation,
        so, keep the current position. */
 #else
+       // Note: NetRadiantCustom still uses window instead of widget.
        Sys_SetCursorPos( widget, recorded_x, recorded_y );
 #endif
 
index 77cb776123d7a03621f64fd32b66af2a17951497..db0234d7c50e1ed58efb5bf6bcb4c6869e2e4659 100644 (file)
 typedef struct _GdkCursor GdkCursor;
 typedef struct _GdkEventMotion GdkEventMotion;
 
+// Note: NetRadiantCustom disables them but we still make use of them.
+#if 1
 GdkCursor* create_blank_cursor();
 void set_cursor( ui::Widget widget, GdkCursorType cursor_type );
 void blank_cursor( ui::Widget widget );
 void default_cursor( ui::Widget widget );
+#endif
 void Sys_GetCursorPos( ui::Widget widget, int *x, int *y );
 void Sys_SetCursorPos( ui::Widget widget, int x, int y );
 
@@ -107,7 +110,7 @@ void motion_delta( int x, int y, unsigned int state ){
 class FreezePointer
 {
 unsigned int handle_motion;
-int recorded_x, recorded_y, last_x, last_y;
+int recorded_x, recorded_y, last_x, last_y, center_x, center_y;
 typedef void ( *MotionDeltaFunction )( int x, int y, unsigned int state, void* data );
 MotionDeltaFunction m_function;
 void* m_data;
index c17a984dc845b2af5b295cedb5f0a7eb7165e610..ee6634e6ea4dad5f6f5efa1e055eda0583fd8c48 100644 (file)
@@ -1324,6 +1324,8 @@ void CamWnd::EnableFreeMove(){
 
        gtk_window_set_focus( m_parent, m_gl_widget );
        m_freemove_handle_focusout = m_gl_widget.connect( "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this );
+       /* Note: We chose to replace m_parent by m_gl_widget but NetRadiantCustom does:
+       m_freezePointer.freeze_pointer( m_parent, m_gl_widget, Camera_motionDelta, &m_Camera ); */
        m_freezePointer.freeze_pointer( m_gl_widget, Camera_motionDelta, &m_Camera );
 
        CamWnd_Update( *this );
index 1d31c01882013c81628c18a151ba4ec7fbaa05c6..2630f10e8d8f2db7f2441c641aa6382802831f81 100644 (file)
@@ -1068,7 +1068,7 @@ void DoTextEditor( const char* filename, int cursorpos, int length ){
                        ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", path.c_str(), 0, 0, SW_SHOW );
                }
                else{
-                       globalOutputStream() << "Failed to open '" << filename << "\n";
+                       globalOutputStream() << "Failed to open '" << filename << "'\nOne sits in .pk3 most likely!\n";
                }
                return;
        }
@@ -1089,7 +1089,7 @@ void DoTextEditor( const char* filename, int cursorpos, int length ){
                        DoGtkTextEditor( path.c_str(), cursorpos, length );
                }
                else{
-                       globalOutputStream() << "Failed to open '" << filename << "\n";
+                       globalOutputStream() << "Failed to open '" << filename << "'\nOne sits in .pk3 most likely!\n";
                }
                return;
        }
index e377c52386b18e26a6da9d533743837603bf1749..689d797d934c3111423b1fd46367c6195d99df32 100644 (file)
@@ -3270,7 +3270,7 @@ void MainFrame::Create(){
                vbox.pack_start( split, TRUE, TRUE, 0 );
 
                {
-            auto frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
+            auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
                        g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
 
                        WORKAROUND_GOBJECT_SET_GLWIDGET( window, TextureBrowser_getGLWidget() );
index 96fe13c2e347d0e7b67e24eddd886bea73edf203..27baf5edb10f821989663c7634ccc2fc8ee23226 100644 (file)
@@ -332,51 +332,12 @@ bool m_hideUnused;
 bool m_rmbSelected;
 bool m_searchedTags;
 bool m_tags;
+bool m_move_started;
 // The uniform size (in pixels) that textures are resized to when m_resizeTextures is true.
 int m_uniformTextureSize;
 int m_uniformTextureMinSize;
 
 // Return the display width of a texture in the texture browser
-/*void getTextureWH( qtexture_t* tex, int *width, int *height ){
-       if ( !g_TextureBrowser_fixedSize ) {
-               // Don't use uniform size
-               *width = (int)( tex->width * ( (float)m_textureScale / 100 ) );
-               *height = (int)( tex->height * ( (float)m_textureScale / 100 ) );
-
-       }
-       else if ( tex->width >= tex->height ) {
-               // Texture is square, or wider than it is tall
-               if ( tex->width >= m_uniformTextureSize ){
-                       *width = m_uniformTextureSize;
-                       *height = (int)( m_uniformTextureSize * ( (float)tex->height / tex->width ) );
-               }
-               else if ( tex->width <= m_uniformTextureMinSize ){
-                       *width = m_uniformTextureMinSize;
-                       *height = (int)( m_uniformTextureMinSize * ( (float)tex->height / tex->width ) );
-               }
-               else {
-                       *width = tex->width;
-                       *height = tex->height;
-               }
-       }
-       else {
-               // Texture taller than it is wide
-               if ( tex->height >= m_uniformTextureSize ){
-                       *height = m_uniformTextureSize;
-                       *width = (int)( m_uniformTextureSize * ( (float)tex->width / tex->height ) );
-               }
-               else if ( tex->height <= m_uniformTextureMinSize ){
-                       *height = m_uniformTextureMinSize;
-                       *width = (int)( m_uniformTextureMinSize * ( (float)tex->width / tex->height ) );
-               }
-               else {
-                       *width = tex->width;
-                       *height = tex->height;
-               }
-       }
-}
-
-*/
 void getTextureWH( qtexture_t* tex, int &W, int &H ){
                // Don't use uniform size
                W = (int)( tex->width * ( (float)m_textureScale / 100 ) );
@@ -435,7 +396,8 @@ TextureBrowser() :
        m_searchedTags( false ),
        m_tags( false ),
        m_uniformTextureSize( 160 ),
-       m_uniformTextureMinSize( 48 ){
+       m_uniformTextureMinSize( 48 ),
+       m_move_started( false ){
 }
 };
 
@@ -1212,14 +1174,24 @@ void TextureBrowser_trackingDelta( int x, int y, unsigned int state, void* data
        }
 }
 
-void TextureBrowser_Tracking_MouseDown( TextureBrowser& textureBrowser ){
-       textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser );
-}
-
 void TextureBrowser_Tracking_MouseUp( TextureBrowser& textureBrowser ){
+       textureBrowser.m_move_started = false;
+       /* Note: NetRadiantCustom did this instead:
+       textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget ); */
+
        textureBrowser.m_freezePointer.unfreeze_pointer( textureBrowser.m_gl_widget );
 }
 
+void TextureBrowser_Tracking_MouseDown( TextureBrowser& textureBrowser ){
+       if( textureBrowser.m_move_started ){
+               TextureBrowser_Tracking_MouseUp( textureBrowser );
+       }
+       textureBrowser.m_move_started = true;
+       /* Note: NetRadiantCustom did this instead:
+       textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_parent, textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser ); */
+       textureBrowser.m_freezePointer.freeze_pointer( textureBrowser.m_gl_widget, TextureBrowser_trackingDelta, &textureBrowser );
+}
+
 void TextureBrowser_Selection_MouseDown( TextureBrowser& textureBrowser, guint32 flags, int pointx, int pointy ){
        SelectTexture( textureBrowser, pointx, textureBrowser.height - 1 - pointy, ( flags & GDK_SHIFT_MASK ) != 0 );
 }
index 3470f861b0834c25f984a62caf646eb0461cea7c..4c07a7fefb03eade4f3210a18df0ab08b57d3062 100644 (file)
@@ -824,7 +824,7 @@ XYWnd::XYWnd() :
        m_parent( ui::null ),
        m_window_observer( NewWindowObserver() ),
        m_XORRectangle( m_gl_widget ),
-       m_chasemouse_handler( 0 ) {
+       m_chasemouse_handler( 0 ){
 
        m_bActive = false;
        m_buttonstate = 0;
@@ -1101,9 +1101,9 @@ void entitycreate_activated( ui::Widget item ){
        else {
                GlobalRadiant().m_pfnMessageBox( MainFrame_getWindow(),
                        "There's already a worldspawn in your map!",
-                       "Info",
-                       eMB_OK,
-                       eMB_ICONDEFAULT );
+                                                                                "Info",
+                                                                                eMB_OK,
+                                                                                eMB_ICONDEFAULT );
        }
 }
 
@@ -1215,6 +1215,8 @@ void XYWnd::Move_Begin(){
                Move_End();
        }
        m_move_started = true;
+       /* Note: NetRadiantCustom did this instead:
+       g_xywnd_freezePointer.freeze_pointer( m_parent  ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this ); */
        g_xywnd_freezePointer.freeze_pointer( m_gl_widget, XYWnd_moveDelta, this );
        m_move_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
 }
@@ -1260,6 +1262,8 @@ void XYWnd::Zoom_Begin(){
        }
        m_zoom_started = true;
        g_dragZoom = 0;
+       /* Note: NetRadiantCustom did this instead:
+       g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this ); */
        g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
        m_zoom_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
 }