]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit '9d6e27e4e37e7406e8691594fb0b74aab89e954b' into garux-merge
authorThomas Debesse <dev@illwieckz.net>
Mon, 25 May 2020 14:35:34 +0000 (16:35 +0200)
committerThomas Debesse <dev@illwieckz.net>
Mon, 25 May 2020 14:35:34 +0000 (16:35 +0200)
1  2 
libs/gtkutil/cursor.cpp
libs/gtkutil/cursor.h
radiant/camwindow.cpp
radiant/gtkdlgs.cpp
radiant/mainframe.cpp
radiant/texwindow.cpp
radiant/xywindow.cpp

index 999621f12ecdb4f633076aace99cd2579bbee9be,ae19afe03d6866b58d093b48bb5af1bbb56507d8..70a0856b68ea9af66e3fbdcbf287825bce8b677e
  #include "stream/textstream.h"
  
  #include <string.h>
 -#include <gdk/gdkcursor.h>
 -#include <gdk/gdkpixmap.h>
 +#include <gdk/gdk.h>
 +#include <gtk/gtk.h>
  
+ #if 0
  GdkCursor* create_blank_cursor(){
 -      GdkPixmap *pixmap;
 -      GdkBitmap *mask;
 -      char buffer [( 32 * 32 ) / 8];
 -      memset( buffer, 0, ( 32 * 32 ) / 8 );
 -      GdkColor white = {0, 0xffff, 0xffff, 0xffff};
 -      GdkColor black = {0, 0x0000, 0x0000, 0x0000};
 -      pixmap = gdk_bitmap_create_from_data( 0, buffer, 32, 32 );
 -      mask   = gdk_bitmap_create_from_data( 0, buffer, 32, 32 );
 -      GdkCursor *cursor = gdk_cursor_new_from_pixmap( pixmap, mask, &white, &black, 1, 1 );
 -      gdk_drawable_unref( pixmap );
 -      gdk_drawable_unref( mask );
 -
 -      return cursor;
 +      return gdk_cursor_new(GDK_BLANK_CURSOR);
  }
  
 -void blank_cursor( GtkWidget* widget ){
 +void blank_cursor( ui::Widget widget ){
        GdkCursor* cursor = create_blank_cursor();
 -      gdk_window_set_cursor( widget->window, cursor );
 +      gdk_window_set_cursor( gtk_widget_get_window(widget), cursor );
        gdk_cursor_unref( cursor );
  }
  
 -void default_cursor( GtkWidget* widget ){
 -      gdk_window_set_cursor( widget->window, 0 );
 +void default_cursor( ui::Widget widget ){
 +      gdk_window_set_cursor( gtk_widget_get_window(widget), 0 );
  }
+ #endif
  
  
 -void Sys_GetCursorPos( GtkWindow* window, int *x, int *y ){
 +void Sys_GetCursorPos( ui::Window window, int *x, int *y ){
        gdk_display_get_pointer( gdk_display_get_default(), 0, x, y, 0 );
  }
  
index 2d16142eb9f71134c1bb93ae384632024c837565,0a6a495d61c5c4e19b330131f690428fe74deb78..3b873db4f92e88fffc0b1a8e087c51282148a1aa
  #include "debugging/debugging.h"
  
  typedef struct _GdkCursor GdkCursor;
 -typedef struct _GtkWidget GtkWidget;
 -typedef struct _GtkWindow GtkWindow;
 +typedef struct _GdkEventMotion GdkEventMotion;
  
+ #if 0
  GdkCursor* create_blank_cursor();
 -void blank_cursor( GtkWidget* widget );
 -void default_cursor( GtkWidget* widget );
 +void blank_cursor( ui::Widget widget );
 +void default_cursor( ui::Widget widget );
+ #endif
 -void Sys_GetCursorPos( GtkWindow* window, int *x, int *y );
 -void Sys_SetCursorPos( GtkWindow* window, int x, int y );
 +void Sys_GetCursorPos( ui::Window window, int *x, int *y );
 +void Sys_SetCursorPos( ui::Window window, int x, int y );
  
  
  
index 2ef5a9862a71d5c9396370c7037397a0aa192521,9a9e6bf25ec825b5f1b2321f6b9f796cc5d42c8c..c96ee2f92cf97d1e0feec4bcd838b85e9249bf70
@@@ -1318,8 -1324,8 +1318,8 @@@ void CamWnd::EnableFreeMove()
        CamWnd_Add_Handlers_FreeMove( *this );
  
        gtk_window_set_focus( m_parent, m_gl_widget );
 -      m_freemove_handle_focusout = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this );
 +      m_freemove_handle_focusout = m_gl_widget.connect( "focus_out_event", G_CALLBACK( camwindow_freemove_focusout ), this );
-       m_freezePointer.freeze_pointer( m_parent, Camera_motionDelta, &m_Camera );
+       m_freezePointer.freeze_pointer( m_parent, m_gl_widget, Camera_motionDelta, &m_Camera );
  
        CamWnd_Update( *this );
  }
index 0a2206069f6a78f98c009dfc6abde978bc32f126,8cc7aeb6282e2f02f8844148304d0f491b74acd6..c7bd3a581bf23eebee130f76b923e221f3a505a4
@@@ -1038,10 -1080,10 +1038,10 @@@ void DoTextEditor( const char* filename
                }
                else if ( file_exists( path.c_str() ) ){
                        globalOutputStream() << "opening file '" << path.c_str() << "' (line " << cursorpos << " info ignored)\n";
 -                      ShellExecute( (HWND)GDK_WINDOW_HWND( GTK_WIDGET( MainFrame_getWindow() )->window ), "open", path.c_str(), 0, 0, SW_SHOW );
 +                      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;
        }
index 63431679ef0f63f2a0b198b5796987b4268a9ed8,2758e8ee719399a735c36d3e5fd67fa551a10163..0141220bb7231c7adc0d8be9f26e423c96cd55f3
@@@ -3186,18 -3022,16 +3186,18 @@@ void MainFrame::Create()
                m_pXZWnd = new XYWnd();
                m_pXZWnd->SetViewType( XZ );
  
 -              GtkWidget* xz = m_pXZWnd->GetWidget();
 +              ui::Widget xz = m_pXZWnd->GetWidget();
  
 -              GtkHPaned* split = create_split_views( camera, yz, xy, xz );
 -              gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( split ), TRUE, TRUE, 0 );
 +        auto split = create_split_views( camera, yz, xy, xz );
 +              vbox.pack_start( split, TRUE, TRUE, 0 );
  
                {
-             auto frame = create_framed_widget( TextureBrowser_constructWindow( window ) );
 -                      GtkFrame* frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
 -                      g_page_textures = GroupDialog_addPage( "Textures", GTK_WIDGET( frame ), TextureBrowserExportTitleCaller() );
++            auto frame = create_framed_widget( TextureBrowser_constructWindow( GroupDialog_getWindow() ) );
 +                      g_page_textures = GroupDialog_addPage( "Textures", frame, TextureBrowserExportTitleCaller() );
 +#ifndef GARUX_GTK_WORKAROUND
                        /* workaround for gtk 2.24 issue: not displayed glwidget after toggle */
                        g_object_set_data( G_OBJECT( GroupDialog_getWindow() ), "glwidget", TextureBrowser_getGLWidget() );
 +#endif
                }
        }
  
index 754c84445ba699c7bcb54039cb5c4df144448ed9,36d6eb84cc14c31629a14f09510064492b427364..6f9205953d4bde22ae4c687834f39d0bdeaf9b26
@@@ -332,48 -276,7 +333,8 @@@ 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 ) );
index 9177f9fefd81b2b0405293fd987656412ad9266e,4d4d75172546e522353406b28365a2c0ae517bfc..ae99174bf856d3ee5a659ca8f46d1083cb6a12cf
@@@ -1210,8 -1205,8 +1210,8 @@@ void XYWnd::Move_Begin()
                Move_End();
        }
        m_move_started = true;
-       g_xywnd_freezePointer.freeze_pointer( m_parent  ? m_parent : MainFrame_getWindow(), XYWnd_moveDelta, this );
 -      g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this );
 -      m_move_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
++      g_xywnd_freezePointer.freeze_pointer( m_parent  ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_moveDelta, this );
 +      m_move_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Move_focusOut ), this );
  }
  
  void XYWnd::Move_End(){
@@@ -1255,8 -1250,8 +1255,8 @@@ void XYWnd::Zoom_Begin()
        }
        m_zoom_started = true;
        g_dragZoom = 0;
-       g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), XYWnd_zoomDelta, this );
 -      g_xywnd_freezePointer.freeze_pointer( m_parent != 0 ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this );
 -      m_zoom_focusOut = g_signal_connect( G_OBJECT( m_gl_widget ), "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
++      g_xywnd_freezePointer.freeze_pointer( m_parent ? m_parent : MainFrame_getWindow(), m_gl_widget, XYWnd_zoomDelta, this );
 +      m_zoom_focusOut = m_gl_widget.connect( "focus_out_event", G_CALLBACK( XYWnd_Zoom_focusOut ), this );
  }
  
  void XYWnd::Zoom_End(){