From: Thomas Debesse Date: Mon, 25 May 2020 14:35:34 +0000 (+0200) Subject: Merge commit '9d6e27e4e37e7406e8691594fb0b74aab89e954b' into garux-merge X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=01a950c3de3ef7f7da23360f925404e2bd385d5d;p=xonotic%2Fnetradiant.git Merge commit '9d6e27e4e37e7406e8691594fb0b74aab89e954b' into garux-merge --- 01a950c3de3ef7f7da23360f925404e2bd385d5d diff --cc libs/gtkutil/cursor.cpp index 999621f1,ae19afe0..70a0856b --- a/libs/gtkutil/cursor.cpp +++ b/libs/gtkutil/cursor.cpp @@@ -24,26 -24,39 +24,27 @@@ #include "stream/textstream.h" #include -#include -#include +#include +#include - + #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 ); } diff --cc libs/gtkutil/cursor.h index 2d16142e,0a6a495d..3b873db4 --- a/libs/gtkutil/cursor.h +++ b/libs/gtkutil/cursor.h @@@ -27,13 -31,16 +27,15 @@@ #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 ); diff --cc radiant/camwindow.cpp index 2ef5a986,9a9e6bf2..c96ee2f9 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@@ -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 ); } diff --cc radiant/gtkdlgs.cpp index 0a220606,8cc7aeb6..c7bd3a58 --- a/radiant/gtkdlgs.cpp +++ b/radiant/gtkdlgs.cpp @@@ -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; } diff --cc radiant/mainframe.cpp index 63431679,2758e8ee..0141220b --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@@ -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 } } diff --cc radiant/texwindow.cpp index 754c8444,36d6eb84..6f920595 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@@ -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 ) ); diff --cc radiant/xywindow.cpp index 9177f9fe,4d4d7517..ae99174b --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@@ -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(){