From: TimePath Date: Wed, 17 Feb 2016 11:03:56 +0000 (+1100) Subject: -DGSEAL_ENABLE X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4959174d6c6a1ac5836fdf2fced660d77c482140;p=xonotic%2Fnetradiant.git -DGSEAL_ENABLE --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 70c60542..bcb4fbc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ find_package(OpenGL REQUIRED) add_definitions(-DRADIANT_EXECUTABLE="${RADIANT_EXECUTABLE}") -add_definitions(-DGTK_DISABLE_SINGLE_INCLUDES) +add_definitions(-DGTK_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE) if(NOT WIN32) add_definitions( diff --git a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp index 359148dd..08bac097 100644 --- a/contrib/bobtoolz/dialogs/dialogs-gtk.cpp +++ b/contrib/bobtoolz/dialogs/dialogs-gtk.cpp @@ -247,7 +247,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default(w, true); gtk_widget_grab_default( w ); gtk_widget_show( w ); ret = eIDOK; @@ -257,7 +257,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -273,7 +273,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -296,7 +296,7 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -323,7 +323,6 @@ EMessageBoxReturn DoMessageBox( const char* lpText, const char* lpCaption, EMess EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){ GtkWidget *window, *w, *vbox, *hbox; - GtkWidget *radio1, *radio2; GtkWidget *check1, *check2; EMessageBoxReturn ret; int loop = 1; @@ -350,11 +349,11 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){ // ---- vbox ---- - radio1 = gtk_radio_button_new_with_label( NULL, "Use Whole Map" ); + auto radio1 = gtk_radio_button_new_with_label( NULL, "Use Whole Map" ); gtk_box_pack_start( GTK_BOX( vbox ), radio1, FALSE, FALSE, 2 ); gtk_widget_show( radio1 ); - radio2 = gtk_radio_button_new_with_label( ( (GtkRadioButton*)radio1 )->group, "Use Selected Brushes" ); + auto radio2 = gtk_radio_button_new_with_label( gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio1)), "Use Selected Brushes" ); gtk_box_pack_start( GTK_BOX( vbox ), radio2, FALSE, FALSE, 2 ); gtk_widget_show( radio2 ); @@ -380,7 +379,7 @@ EMessageBoxReturn DoIntersectBox( IntersectRS* rs ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -534,7 +533,7 @@ EMessageBoxReturn DoPolygonBox( PolygonRS* rs ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -775,7 +774,7 @@ EMessageBoxReturn DoBuildStairsBox( BuildStairsRS* rs ){ w = ui::Button( "OK" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -1020,7 +1019,7 @@ EMessageBoxReturn DoDoorsBox( DoorRS* rs ){ w = ui::Button( "OK" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -1183,7 +1182,7 @@ EMessageBoxReturn DoPathPlotterBox( PathPlotterRS* rs ){ gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDYES ) ); gtk_widget_show( w ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); w = ui::Button( "Disable" ); @@ -1273,7 +1272,7 @@ EMessageBoxReturn DoCTFColourChangeBox(){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -1552,7 +1551,7 @@ EMessageBoxReturn DoResetTextureBox( ResetTextureRS* rs ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -1839,7 +1838,7 @@ EMessageBoxReturn DoTrainThingBox( TrainThingRS* rs ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -1977,7 +1976,7 @@ EMessageBoxReturn DoMakeChainBox( MakeChainRS* rs ){ w = ui::Button( "OK" ); gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); diff --git a/contrib/brushexport/support.cpp b/contrib/brushexport/support.cpp index c74ef620..768f213a 100644 --- a/contrib/brushexport/support.cpp +++ b/contrib/brushexport/support.cpp @@ -14,7 +14,7 @@ lookup_widget( GtkWidget *widget, parent = gtk_menu_get_attach_widget( GTK_MENU( widget ) ); } else{ - parent = widget->parent; + parent = gtk_widget_get_parent(widget); } if ( !parent ) { parent = (GtkWidget*) g_object_get_data( G_OBJECT( widget ), "GladeParentKey" ); diff --git a/contrib/camera/dialogs.cpp b/contrib/camera/dialogs.cpp index 6d1c30cf..43c2543b 100644 --- a/contrib/camera/dialogs.cpp +++ b/contrib/camera/dialogs.cpp @@ -134,7 +134,7 @@ static gint ci_new( GtkWidget *widget, gpointer data ){ gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_show( w ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); w = ui::Button( "Cancel" ); @@ -314,7 +314,7 @@ static gint ci_pathlist_changed( GtkWidget *widget, gpointer data ){ } // start edit mode - if ( g_pCameraInspectorWnd && GTK_WIDGET_VISIBLE( g_pCameraInspectorWnd ) ) { + if ( g_pCameraInspectorWnd && gtk_widget_get_visible( g_pCameraInspectorWnd ) ) { DoStartEdit( GetCurrentCam() ); } @@ -416,7 +416,7 @@ static gint ci_rename( GtkWidget *widget, gpointer data ){ gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_show( w ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); w = ui::Button( "Cancel" ); @@ -563,7 +563,7 @@ static gint ci_add_target( GtkWidget *widget, gpointer data ){ gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_show( w ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); w = ui::Button( "Cancel" ); @@ -756,7 +756,7 @@ static gint ci_camlist_changed( GtkWidget *widget, gpointer data ){ // start edit mode g_iActiveTarget = -1; - if ( g_pCameraInspectorWnd && GTK_WIDGET_VISIBLE( g_pCameraInspectorWnd ) ) { + if ( g_pCameraInspectorWnd && gtk_widget_get_visible( g_pCameraInspectorWnd ) ) { DoStartEdit( GetCurrentCam() ); } @@ -903,7 +903,7 @@ static gint ci_add( GtkWidget *widget, gpointer data ){ gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( eIDOK ) ); gtk_widget_show( w ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); w = ui::Button( "Cancel" ); @@ -1356,7 +1356,7 @@ GtkWidget *CreateCameraInspectorDialog( void ){ w = gtk_button_new_with_label( "Close" ); gtk_box_pack_start( GTK_BOX( vbox ), w, FALSE, FALSE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( ci_close ), NULL ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); diff --git a/contrib/gtkgensurf/gensurf.cpp b/contrib/gtkgensurf/gensurf.cpp index 4f05ec4a..efb5a881 100644 --- a/contrib/gtkgensurf/gensurf.cpp +++ b/contrib/gtkgensurf/gensurf.cpp @@ -409,7 +409,7 @@ void WriteIniFile( const char *file ){ } void UpdatePreview( bool DataChange ){ - if ( g_pWndPreview && GTK_WIDGET_VISIBLE( g_pWndPreview ) ) { + if ( g_pWndPreview && gtk_widget_get_visible( g_pWndPreview ) ) { if ( DataChange ) { GenerateXYZ(); } diff --git a/contrib/hydratoolz/plugin.cpp b/contrib/hydratoolz/plugin.cpp index 311eab2e..a290649f 100644 --- a/contrib/hydratoolz/plugin.cpp +++ b/contrib/hydratoolz/plugin.cpp @@ -117,7 +117,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); ret = IDOK; @@ -127,7 +127,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -143,7 +143,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -166,7 +166,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); diff --git a/contrib/prtview/ConfigDialog.cpp b/contrib/prtview/ConfigDialog.cpp index aa2f7bb6..3a824590 100644 --- a/contrib/prtview/ConfigDialog.cpp +++ b/contrib/prtview/ConfigDialog.cpp @@ -63,14 +63,18 @@ static int DoColor( PackedColour *c ){ clr[2] = ( (double)GetBValue( *c ) ) / 255.0; dlg = gtk_color_selection_dialog_new( "Choose Color" ); - gtk_color_selection_set_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr ); + gtk_color_selection_set_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), clr ); gtk_signal_connect( GTK_OBJECT( dlg ), "delete_event", GTK_SIGNAL_FUNC( dialog_delete_callback ), NULL ); gtk_signal_connect( GTK_OBJECT( dlg ), "destroy", GTK_SIGNAL_FUNC( gtk_widget_destroy ), NULL ); - gtk_signal_connect( GTK_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->ok_button ), "clicked", + + GtkWidget *ok_button, *cancel_button; + g_object_get(dlg, "ok-button", &ok_button, "cancel-button", &cancel_button, nullptr); + + gtk_signal_connect( GTK_OBJECT(ok_button), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - gtk_signal_connect( GTK_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->cancel_button ), "clicked", + gtk_signal_connect( GTK_OBJECT(cancel_button), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDCANCEL ) ); g_object_set_data( G_OBJECT( dlg ), "loop", &loop ); g_object_set_data( G_OBJECT( dlg ), "ret", &ret ); @@ -81,7 +85,7 @@ static int DoColor( PackedColour *c ){ while ( loop ) gtk_main_iteration(); - gtk_color_selection_get_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr ); + gtk_color_selection_get_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dlg)) ), clr ); gtk_grab_remove( dlg ); gtk_widget_destroy( dlg ); @@ -126,7 +130,7 @@ static void SetClipText( GtkWidget* label ){ } static void OnScroll2d( GtkAdjustment *adj, gpointer data ){ - portals.width_2d = static_cast( adj->value ); + portals.width_2d = static_cast( gtk_adjustment_get_value(adj) ); Set2DText( GTK_WIDGET( data ) ); Portals_shadersChanged(); @@ -134,21 +138,21 @@ static void OnScroll2d( GtkAdjustment *adj, gpointer data ){ } static void OnScroll3d( GtkAdjustment *adj, gpointer data ){ - portals.width_3d = static_cast( adj->value ); + portals.width_3d = static_cast( gtk_adjustment_get_value(adj) ); Set3DText( GTK_WIDGET( data ) ); SceneChangeNotify(); } static void OnScrollTrans( GtkAdjustment *adj, gpointer data ){ - portals.trans_3d = static_cast( adj->value ); + portals.trans_3d = static_cast( gtk_adjustment_get_value(adj) ); Set3DTransText( GTK_WIDGET( data ) ); SceneChangeNotify(); } static void OnScrollClip( GtkAdjustment *adj, gpointer data ){ - portals.clip_range = static_cast( adj->value ); + portals.clip_range = static_cast( gtk_adjustment_get_value(adj) ); SetClipText( GTK_WIDGET( data ) ); SceneChangeNotify(); diff --git a/libs/gtkutil/accelerator.cpp b/libs/gtkutil/accelerator.cpp index c80d982a..e6e149a3 100644 --- a/libs/gtkutil/accelerator.cpp +++ b/libs/gtkutil/accelerator.cpp @@ -239,7 +239,7 @@ bool Buttons_press( ButtonMask& buttons, guint button, guint state ){ { GtkWindow* toplevel = *i; ASSERT_MESSAGE( window_has_accel( toplevel ), "ERROR" ); - ASSERT_MESSAGE( GTK_WIDGET_TOPLEVEL( toplevel ), "disabling accel for non-toplevel window" ); + ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET(toplevel) ), "disabling accel for non-toplevel window" ); gtk_window_remove_accel_group( toplevel, global_accel ); #if 0 globalOutputStream() << reinterpret_cast( toplevel ) << ": disabled global accelerators\n"; @@ -265,7 +265,7 @@ bool Buttons_release( ButtonMask& buttons, guint button, guint state ){ { GtkWindow* toplevel = *i; ASSERT_MESSAGE( !window_has_accel( toplevel ), "ERROR" ); - ASSERT_MESSAGE( GTK_WIDGET_TOPLEVEL( toplevel ), "enabling accel for non-toplevel window" ); + ASSERT_MESSAGE( gtk_widget_is_toplevel( GTK_WIDGET(toplevel) ), "enabling accel for non-toplevel window" ); gtk_window_add_accel_group( toplevel, global_accel ); #if 0 globalOutputStream() << reinterpret_cast( toplevel ) << ": enabled global accelerators\n"; @@ -560,7 +560,7 @@ GClosure* global_accel_group_find( Accelerator accelerator ){ } return entry->closure; } - return 0; + return nullptr; } void global_accel_group_connect( const Accelerator& accelerator, const Callback& callback ){ diff --git a/libs/gtkutil/clipboard.cpp b/libs/gtkutil/clipboard.cpp index 0d96b3fb..29148753 100644 --- a/libs/gtkutil/clipboard.cpp +++ b/libs/gtkutil/clipboard.cpp @@ -111,11 +111,11 @@ static void clipboard_clear( GtkClipboard *clipboard, gpointer data ){ } static void clipboard_received( GtkClipboard *clipboard, GtkSelectionData *data, gpointer user_data ){ - if ( data->length < 0 ) { + if ( gtk_selection_data_get_length(data) < 0 ) { globalErrorStream() << "Error retrieving selection\n"; } - else if ( strcmp( gdk_atom_name( data->type ), clipboard_targets[0].target ) == 0 ) { - BufferInputStream istream( reinterpret_cast( data->data ), data->length ); + else if ( strcmp( gdk_atom_name( gtk_selection_data_get_data_type(data) ), clipboard_targets[0].target ) == 0 ) { + BufferInputStream istream( reinterpret_cast( gtk_selection_data_get_data(data) ), gtk_selection_data_get_length(data) ); ( *reinterpret_cast( user_data ) )( istream ); } } diff --git a/libs/gtkutil/cursor.cpp b/libs/gtkutil/cursor.cpp index 287b97de..0fe946f6 100644 --- a/libs/gtkutil/cursor.cpp +++ b/libs/gtkutil/cursor.cpp @@ -45,12 +45,12 @@ GdkCursor* create_blank_cursor(){ void blank_cursor( GtkWidget* 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 ); + gdk_window_set_cursor( gtk_widget_get_window(widget), 0 ); } diff --git a/libs/gtkutil/cursor.h b/libs/gtkutil/cursor.h index 4e7d4fac..bf4f6ee8 100644 --- a/libs/gtkutil/cursor.h +++ b/libs/gtkutil/cursor.h @@ -155,7 +155,7 @@ void freeze_pointer( GtkWindow* window, MotionDeltaFunction function, void* data GdkCursor* cursor = create_blank_cursor(); //GdkGrabStatus status = - gdk_pointer_grab( GTK_WIDGET( window )->window, TRUE, mask, 0, cursor, GDK_CURRENT_TIME ); + gdk_pointer_grab( gtk_widget_get_window(GTK_WIDGET(window)), TRUE, mask, 0, cursor, GDK_CURRENT_TIME ); gdk_cursor_unref( cursor ); Sys_GetCursorPos( window, &recorded_x, &recorded_y ); diff --git a/libs/gtkutil/menu.cpp b/libs/gtkutil/menu.cpp index 1cdc373a..4f6eb3ae 100644 --- a/libs/gtkutil/menu.cpp +++ b/libs/gtkutil/menu.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "generic/callback.h" @@ -223,38 +224,11 @@ void accelerator_name( const Accelerator& accelerator, GString* gstring ){ } } -void menu_item_set_accelerator( GtkMenuItem* item, Accelerator accelerator ){ - GtkAccelLabel* accel_label = GTK_ACCEL_LABEL( gtk_bin_get_child( GTK_BIN( item ) ) ); - - g_free( accel_label->accel_string ); - accel_label->accel_string = 0; - - GString* gstring = g_string_new( accel_label->accel_string ); - g_string_append( gstring, " " ); - - accelerator_name( accelerator, gstring ); - - g_free( accel_label->accel_string ); - accel_label->accel_string = gstring->str; - g_string_free( gstring, FALSE ); - - if ( !accel_label->accel_string ) { - accel_label->accel_string = g_strdup( "" ); - } - - gtk_widget_queue_resize( GTK_WIDGET( accel_label ) ); -} - void menu_item_add_accelerator( GtkMenuItem* item, Accelerator accelerator ){ if ( accelerator.key != 0 ) { GClosure* closure = global_accel_group_find( accelerator ); - if ( closure != 0 ) { - menu_item_set_accelerator( item, closure ); - } - else - { - menu_item_set_accelerator( item, accelerator ); - } + ASSERT_NOTNULL(closure); + menu_item_set_accelerator( item, closure ); } } diff --git a/libs/gtkutil/nonmodal.h b/libs/gtkutil/nonmodal.h index d251ca4c..345eaac2 100644 --- a/libs/gtkutil/nonmodal.h +++ b/libs/gtkutil/nonmodal.h @@ -58,7 +58,7 @@ static gboolean focus_in( GtkEntry* entry, GdkEventFocus *event, NonModalEntry* } static gboolean focus_out( GtkEntry* entry, GdkEventFocus *event, NonModalEntry* self ){ - if ( self->m_editing && GTK_WIDGET_VISIBLE( entry ) ) { + if ( self->m_editing && gtk_widget_get_visible( GTK_WIDGET(entry) ) ) { self->m_apply(); } self->m_editing = false; diff --git a/libs/gtkutil/toolbar.cpp b/libs/gtkutil/toolbar.cpp index 7b32ae0e..0c19b9ff 100644 --- a/libs/gtkutil/toolbar.cpp +++ b/libs/gtkutil/toolbar.cpp @@ -35,8 +35,8 @@ void toolbar_append( GtkToolbar* toolbar, GtkButton* button, const char* description ){ gtk_widget_show( GTK_WIDGET( button ) ); gtk_button_set_relief( button, GTK_RELIEF_NONE ); - GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_FOCUS ); - GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( button ), GTK_CAN_DEFAULT ); + gtk_widget_set_can_focus(GTK_WIDGET( button ), false); + gtk_widget_set_can_default(GTK_WIDGET( button ), false); gtk_toolbar_append_element( toolbar, GTK_TOOLBAR_CHILD_WIDGET, GTK_WIDGET( button ), "", description, "", 0, 0, 0 ); } diff --git a/libs/gtkutil/widget.h b/libs/gtkutil/widget.h index 4e83e895..bf84eef0 100644 --- a/libs/gtkutil/widget.h +++ b/libs/gtkutil/widget.h @@ -39,7 +39,7 @@ inline void widget_set_visible( GtkWidget* widget, bool shown ){ } inline bool widget_is_visible( GtkWidget* widget ){ - return GTK_WIDGET_VISIBLE( widget ) != FALSE; + return gtk_widget_get_visible( widget ) != FALSE; } inline void widget_toggle_visible( GtkWidget* widget ){ @@ -81,7 +81,7 @@ static gboolean notify_visible( GtkWidget* widget, gpointer dummy, ToggleShown* return FALSE; } static gboolean destroy( GtkWidget* widget, ToggleShown* self ){ - self->m_shownDeferred = GTK_WIDGET_VISIBLE( self->m_widget ) != FALSE; + self->m_shownDeferred = gtk_widget_get_visible( self->m_widget ) != FALSE; self->m_widget = 0; return FALSE; } @@ -101,7 +101,7 @@ bool active() const { } else { - return GTK_WIDGET_VISIBLE( m_widget ) != FALSE; + return gtk_widget_get_visible( m_widget ) != FALSE; } } void exportActive( const BoolImportCallback& importCallback ){ @@ -138,7 +138,7 @@ typedef ReferenceCaller WidgetQueueDrawCaller; inline void widget_make_default( GtkWidget* widget ){ - GTK_WIDGET_SET_FLAGS( widget, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( widget, true ); gtk_widget_grab_default( widget ); } diff --git a/libs/gtkutil/window.cpp b/libs/gtkutil/window.cpp index b7be2d0e..07e04e56 100644 --- a/libs/gtkutil/window.cpp +++ b/libs/gtkutil/window.cpp @@ -34,7 +34,7 @@ inline void CHECK_RESTORE( GtkWidget* w ){ } inline void CHECK_MINIMIZE( GtkWidget* w ){ - g_object_set_data( G_OBJECT( w ), "was_mapped", gint_to_pointer( GTK_WIDGET_VISIBLE( w ) ) ); + g_object_set_data( G_OBJECT( w ), "was_mapped", gint_to_pointer( gtk_widget_get_visible( w ) ) ); gtk_widget_hide( w ); } @@ -101,7 +101,7 @@ void destroy_floating_window( GtkWindow* window ){ } gint window_realize_remove_sysmenu( GtkWidget* widget, gpointer data ){ - gdk_window_set_decorations( widget->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU ) ); + gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU ) ); return FALSE; } @@ -128,7 +128,7 @@ GtkWindow* create_persistent_floating_window( const char* title, GtkWindow* main } gint window_realize_remove_minmax( GtkWidget* widget, gpointer data ){ - gdk_window_set_decorations( widget->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) ); + gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) ); return FALSE; } diff --git a/libs/gtkutil/xorrectangle.h b/libs/gtkutil/xorrectangle.h index 52d4c6e8..f5ff5aa5 100644 --- a/libs/gtkutil/xorrectangle.h +++ b/libs/gtkutil/xorrectangle.h @@ -72,12 +72,12 @@ bool initialised() const { } void lazy_init(){ if ( !initialised() ) { - m_gc = gdk_gc_new( m_widget->window ); + m_gc = gdk_gc_new( gtk_widget_get_window(m_widget) ); GdkColor color = { 0, 0xffff, 0xffff, 0xffff, }; - GdkColormap* colormap = gdk_window_get_colormap( m_widget->window ); + GdkColormap* colormap = gdk_window_get_colormap( gtk_widget_get_window(m_widget) ); gdk_colormap_alloc_color( colormap, &color, FALSE, TRUE ); - gdk_gc_copy( m_gc, m_widget->style->white_gc ); + gdk_gc_copy( m_gc, gtk_widget_get_style(m_widget)->white_gc ); gdk_gc_set_foreground( m_gc, &color ); gdk_gc_set_background( m_gc, &color ); @@ -89,7 +89,9 @@ void draw() const { const int y = float_to_integer( m_rectangle.y ); const int w = float_to_integer( m_rectangle.w ); const int h = float_to_integer( m_rectangle.h ); - gdk_draw_rectangle( m_widget->window, m_gc, FALSE, x, -( h ) - ( y - m_widget->allocation.height ), w, h ); + GtkAllocation allocation; + gtk_widget_get_allocation(m_widget, &allocation); + gdk_draw_rectangle( gtk_widget_get_window(m_widget), m_gc, FALSE, x, -( h ) - ( y - allocation.height ), w, h ); } public: @@ -101,7 +103,7 @@ XORRectangle( ui::Widget widget ) : m_widget( widget ), m_gc( 0 ){ } } void set( rectangle_t rectangle ){ - if ( GTK_WIDGET_REALIZED( m_widget ) ) { + if ( gtk_widget_get_realized( m_widget ) ) { lazy_init(); draw(); m_rectangle = rectangle; diff --git a/plugins/textool/TexTool.cpp b/plugins/textool/TexTool.cpp index 39ef3d4e..162eb8a8 100644 --- a/plugins/textool/TexTool.cpp +++ b/plugins/textool/TexTool.cpp @@ -87,7 +87,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); ret = IDOK; @@ -97,7 +97,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDOK ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -113,7 +113,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); @@ -136,7 +136,7 @@ int DoMessageBox( const char* lpText, const char* lpCaption, guint32 uType ){ gtk_box_pack_start( GTK_BOX( hbox ), w, TRUE, TRUE, 0 ); gtk_signal_connect( GTK_OBJECT( w ), "clicked", GTK_SIGNAL_FUNC( dialog_button_callback ), GINT_TO_POINTER( IDYES ) ); - GTK_WIDGET_SET_FLAGS( w, GTK_CAN_DEFAULT ); + gtk_widget_set_can_default( w, true ); gtk_widget_grab_default( w ); gtk_widget_show( w ); diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index 542d019d..a04f1ecf 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -824,7 +824,7 @@ gboolean mousecontrol_button_press( ui::Widget widget, GdkEventButton* event, Ca #endif void camwnd_update_xor_rectangle( CamWnd& self, rect_t area ){ - if ( GTK_WIDGET_VISIBLE( self.m_gl_widget ) ) { + if ( gtk_widget_get_visible( self.m_gl_widget ) ) { self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.getCamera().width, self.getCamera().height ) ); } } @@ -850,7 +850,9 @@ void selection_motion( gdouble x, gdouble y, guint state, void* data ){ } inline WindowVector windowvector_for_widget_centre( ui::Widget widget ){ - return WindowVector( static_cast( GTK_WIDGET(widget)->allocation.width / 2 ), static_cast(GTK_WIDGET(widget)->allocation.height / 2 ) ); + GtkAllocation allocation; + gtk_widget_get_allocation(widget, &allocation); + return WindowVector( static_cast( allocation.width / 2 ), static_cast(allocation.height / 2 ) ); } gboolean selection_button_press_freemove( ui::Widget widget, GdkEventButton* event, WindowObserver* observer ){ @@ -1162,7 +1164,7 @@ CamWnd::CamWnd() : gtk_widget_ref( m_gl_widget ); gtk_widget_set_events( m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK ); - GTK_WIDGET_SET_FLAGS( m_gl_widget, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( m_gl_widget, true ); m_sizeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "size_allocate", G_CALLBACK( camera_size_allocate ), this ); m_exposeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "expose_event", G_CALLBACK( camera_expose ), this ); diff --git a/radiant/console.cpp b/radiant/console.cpp index 42e6ac7f..ad169054 100644 --- a/radiant/console.cpp +++ b/radiant/console.cpp @@ -212,7 +212,7 @@ std::size_t Sys_Print( int level, const char* buf, std::size_t length ){ if ( contains_newline ) { gtk_text_view_scroll_mark_onscreen( GTK_TEXT_VIEW( g_console ), end ); - if ( !ScreenUpdates_Enabled() && GTK_WIDGET_REALIZED( g_console ) ) { + if ( !ScreenUpdates_Enabled() && gtk_widget_get_realized( g_console ) ) { ScreenUpdates_process(); } } diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 9708bd42..f1860238 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -863,7 +863,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ for ( int i = 0; i < g_spawnflag_count; ++i ) { ui::Widget widget = ui::Widget(GTK_WIDGET( g_entitySpawnflagsCheck[i] )); - gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), " " ); + gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), " " ); gtk_widget_hide( widget ); gtk_widget_ref( widget ); gtk_container_remove( GTK_CONTAINER( g_spawnflagsTable ), widget ); @@ -886,7 +886,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ (GtkAttachOptions)( GTK_FILL ), 0, 0 ); gtk_widget_unref( widget ); - gtk_label_set_text( GTK_LABEL( GTK_BIN( widget )->child ), str.c_str() ); + gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN(widget)) ), str.c_str() ); } } } @@ -902,7 +902,7 @@ void EntityClassList_selectEntityClass( EntityClass* eclass ){ GtkTreeView* view = g_entityClassList; GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path ); - if ( GTK_WIDGET_REALIZED( view ) ) { + if ( gtk_widget_get_realized( GTK_WIDGET(view) ) ) { gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 ); } gtk_tree_path_free( path ); @@ -1220,7 +1220,7 @@ static gint EntityClassList_keypress( ui::Widget widget, GdkEventKey* event, gpo if ( toupper( text[0] ) == (int)code ) { GtkTreePath* path = gtk_tree_model_get_path( model, &iter ); gtk_tree_selection_select_path( gtk_tree_view_get_selection( view ), path ); - if ( GTK_WIDGET_REALIZED( view ) ) { + if ( gtk_widget_get_realized( GTK_WIDGET(view) ) ) { gtk_tree_view_scroll_to_cell( view, path, 0, FALSE, 0, 0 ); } gtk_tree_path_free( path ); diff --git a/radiant/entitylist.cpp b/radiant/entitylist.cpp index 936dd520..a9b9a668 100644 --- a/radiant/entitylist.cpp +++ b/radiant/entitylist.cpp @@ -73,7 +73,7 @@ EntityList() : } bool visible() const { - return GTK_WIDGET_VISIBLE( m_window ); + return gtk_widget_get_visible( m_window ); } }; diff --git a/radiant/findtexturedialog.cpp b/radiant/findtexturedialog.cpp index 12546173..abd0fb84 100644 --- a/radiant/findtexturedialog.cpp +++ b/radiant/findtexturedialog.cpp @@ -221,7 +221,7 @@ void FindTextureDialog::updateTextures( const char* name ){ } bool FindTextureDialog::isOpen(){ - return GTK_WIDGET_VISIBLE( g_FindTextureDialog.GetWidget() ) == TRUE; + return gtk_widget_get_visible( g_FindTextureDialog.GetWidget() ) == TRUE; } void FindTextureDialog::setFindStr( const char* name ){ diff --git a/radiant/gtkmisc.cpp b/radiant/gtkmisc.cpp index efa03ca7..d9cd7ed0 100644 --- a/radiant/gtkmisc.cpp +++ b/radiant/gtkmisc.cpp @@ -107,10 +107,12 @@ bool color_dialog( ui::Widget parent, Vector3& color, const char* title ){ clr[2] = color[2]; dlg = ui::Widget(gtk_color_selection_dialog_new( title )); - gtk_color_selection_set_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), clr ); + gtk_color_selection_set_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG( dlg )) ), clr ); g_signal_connect( G_OBJECT( dlg ), "delete_event", G_CALLBACK( dialog_delete_callback ), &dialog ); - g_signal_connect( G_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->ok_button ), "clicked", G_CALLBACK( dialog_button_ok ), &dialog ); - g_signal_connect( G_OBJECT( GTK_COLOR_SELECTION_DIALOG( dlg )->cancel_button ), "clicked", G_CALLBACK( dialog_button_cancel ), &dialog ); + GtkWidget *ok_button, *cancel_button; + g_object_get(dlg, "ok-button", &ok_button, "cancel-button", &cancel_button, nullptr); + g_signal_connect( ok_button, "clicked", G_CALLBACK( dialog_button_ok ), &dialog ); + g_signal_connect( cancel_button, "clicked", G_CALLBACK( dialog_button_cancel ), &dialog ); if ( parent ) { gtk_window_set_transient_for( GTK_WINDOW( dlg ), GTK_WINDOW( parent ) ); @@ -119,7 +121,7 @@ bool color_dialog( ui::Widget parent, Vector3& color, const char* title ){ bool ok = modal_dialog_show( GTK_WINDOW( dlg ), dialog ) == eIDOK; if ( ok ) { GdkColor gdkcolor; - gtk_color_selection_get_current_color( GTK_COLOR_SELECTION( GTK_COLOR_SELECTION_DIALOG( dlg )->colorsel ), &gdkcolor ); + gtk_color_selection_get_current_color( GTK_COLOR_SELECTION( gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG( dlg )) ), &gdkcolor ); clr[0] = gdkcolor.red / 65535.0; clr[1] = gdkcolor.green / 65535.0; clr[2] = gdkcolor.blue / 65535.0; diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp index b75225eb..90facfde 100644 --- a/radiant/mainframe.cpp +++ b/radiant/mainframe.cpp @@ -1600,7 +1600,7 @@ void EverySecondTimer_disable(){ } gint window_realize_remove_decoration( ui::Widget widget, gpointer data ){ - gdk_window_set_decorations( GTK_WIDGET(widget)->window, (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) ); + gdk_window_set_decorations( gtk_widget_get_window(widget), (GdkWMDecoration)( GDK_DECOR_ALL | GDK_DECOR_MENU | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE ) ); return FALSE; } @@ -1672,7 +1672,7 @@ bool ScreenUpdates_Enabled(){ } void ScreenUpdates_process(){ - if ( redrawRequired() && GTK_WIDGET_VISIBLE( g_wait.m_window ) ) { + if ( redrawRequired() && gtk_widget_get_visible( g_wait.m_window ) ) { process_gui(); } } @@ -1694,7 +1694,7 @@ void ScreenUpdates_Disable( const char* message, const char* title ){ ScreenUpdates_process(); } } - else if ( GTK_WIDGET_VISIBLE( g_wait.m_window ) ) { + else if ( gtk_widget_get_visible( g_wait.m_window ) ) { gtk_label_set_text( g_wait.m_label, message ); ScreenUpdates_process(); } @@ -1714,7 +1714,7 @@ void ScreenUpdates_Enable(){ //gtk_window_present(MainFrame_getWindow()); } - else if ( GTK_WIDGET_VISIBLE( g_wait.m_window ) ) { + else if ( gtk_widget_get_visible( g_wait.m_window ) ) { gtk_label_set_text( g_wait.m_label, g_wait_stack.back().c_str() ); ScreenUpdates_process(); } @@ -2460,7 +2460,7 @@ WindowFocusPrinter g_mainframeFocusPrinter( "mainframe" ); class MainWindowActive { static gboolean notify( ui::Window window, gpointer dummy, MainWindowActive* self ){ - if ( g_wait.m_window && gtk_window_is_active( window ) && !GTK_WIDGET_VISIBLE( g_wait.m_window ) ) { + if ( g_wait.m_window && gtk_window_is_active( window ) && !gtk_widget_get_visible( g_wait.m_window ) ) { gtk_widget_show( GTK_WIDGET( g_wait.m_window ) ); } @@ -2999,7 +2999,7 @@ void MainFrame::SaveWindowInfo(){ g_layout_globals.m_position = m_position_tracker.getPosition(); - g_layout_globals.nState = gdk_window_get_state( GTK_WIDGET( m_window )->window ); + g_layout_globals.nState = gdk_window_get_state( gtk_widget_get_window(GTK_WIDGET( m_window )) ); } void MainFrame::Shutdown(){ diff --git a/radiant/mru.cpp b/radiant/mru.cpp index 67690be1..aadb1d78 100644 --- a/radiant/mru.cpp +++ b/radiant/mru.cpp @@ -159,7 +159,7 @@ void MRU_Activate( std::size_t index ){ MRU_SetText( i, MRU_GetText( i + 1 ) ); if ( MRU_used == 0 ) { - gtk_label_set_text( GTK_LABEL( GTK_BIN( MRU_items[0] )->child ), "Recent Files" ); + gtk_label_set_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN( MRU_items[0] )) ), "Recent Files" ); gtk_widget_set_sensitive( GTK_WIDGET( MRU_items[0] ), FALSE ); } else diff --git a/radiant/patchdialog.cpp b/radiant/patchdialog.cpp index bbe466c1..9e7dd8b3 100644 --- a/radiant/patchdialog.cpp +++ b/radiant/patchdialog.cpp @@ -257,7 +257,7 @@ PatchInspector() : } bool visible(){ - return GTK_WIDGET_VISIBLE( GetWidget() ); + return gtk_widget_get_visible( GetWidget() ); } // void UpdateInfo(); @@ -458,14 +458,14 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ td.scale[0] = td.scale[1] = 0; td.shift[0] = td.shift[1] = 0; - if ( adj->value == 0 ) { + if ( gtk_adjustment_get_value(adj) == 0 ) { return; } if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "hshift_adj" ) ) { g_pi_globals.shift[0] = static_cast( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) ); - if ( adj->value > 0 ) { + if ( gtk_adjustment_get_value(adj) > 0 ) { td.shift[0] = g_pi_globals.shift[0]; } else{ @@ -475,7 +475,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ else if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "vshift_adj" ) ) { g_pi_globals.shift[1] = static_cast( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) ); - if ( adj->value > 0 ) { + if ( gtk_adjustment_get_value(adj) > 0 ) { td.shift[1] = g_pi_globals.shift[1]; } else{ @@ -487,7 +487,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ if ( g_pi_globals.scale[0] == 0.0f ) { return; } - if ( adj->value > 0 ) { + if ( gtk_adjustment_get_value(adj) > 0 ) { td.scale[0] = g_pi_globals.scale[0]; } else{ @@ -499,7 +499,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ if ( g_pi_globals.scale[1] == 0.0f ) { return; } - if ( adj->value > 0 ) { + if ( gtk_adjustment_get_value(adj) > 0 ) { td.scale[1] = g_pi_globals.scale[1]; } else{ @@ -509,7 +509,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ else if ( adj == g_object_get_data( G_OBJECT( g_PatchInspector.GetWidget() ), "rotate_adj" ) ) { g_pi_globals.rotate = static_cast( atof( gtk_entry_get_text( GTK_ENTRY( data ) ) ) ); - if ( adj->value > 0 ) { + if ( gtk_adjustment_get_value(adj) > 0 ) { td.rotate = g_pi_globals.rotate; } else{ @@ -517,7 +517,7 @@ static void OnSpinChanged( GtkAdjustment *adj, gpointer data ){ } } - adj->value = 0; + gtk_adjustment_set_value(adj, 0); // will scale shift rotate the patch accordingly @@ -898,13 +898,13 @@ ui::Window PatchInspector::BuildDialog(){ g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "hshift_adj", adj ); - GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 ); + auto spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( GTK_WIDGET( spin ) ); gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 0, 1, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 ); - GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( spin, false ); } { GtkEntry* entry = ui::Entry(); @@ -919,13 +919,13 @@ ui::Window PatchInspector::BuildDialog(){ g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "vshift_adj", adj ); - GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 ); + auto spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( GTK_WIDGET( spin ) ); gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 1, 2, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 ); - GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( spin, false ); } { GtkEntry* entry = ui::Entry(); @@ -940,13 +940,13 @@ ui::Window PatchInspector::BuildDialog(){ g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "hscale_adj", adj ); - GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 ); + auto spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( GTK_WIDGET( spin ) ); gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 2, 3, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 ); - GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( spin, false ); } { GtkEntry* entry = ui::Entry(); @@ -961,13 +961,13 @@ ui::Window PatchInspector::BuildDialog(){ g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "vscale_adj", adj ); - GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 ); + auto spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( GTK_WIDGET( spin ) ); gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 3, 4, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 ); - GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( spin, false ); } { GtkEntry* entry = ui::Entry(); @@ -982,13 +982,13 @@ ui::Window PatchInspector::BuildDialog(){ g_signal_connect( G_OBJECT( adj ), "value_changed", G_CALLBACK( OnSpinChanged ), entry ); g_object_set_data( G_OBJECT( window ), "rotate_adj", adj ); - GtkSpinButton* spin = ui::SpinButton( adj, 1, 0 ); + auto spin = ui::SpinButton( adj, 1, 0 ); gtk_widget_show( GTK_WIDGET( spin ) ); gtk_table_attach( table, GTK_WIDGET( spin ), 1, 2, 4, 5, (GtkAttachOptions)( 0 ), (GtkAttachOptions)( 0 ), 0, 0 ); gtk_widget_set_usize( GTK_WIDGET( spin ), 10, -2 ); - GTK_WIDGET_UNSET_FLAGS( spin, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( spin, false ); } } GtkHBox* hbox2 = ui::HBox( TRUE, 5 ); diff --git a/radiant/preferences.cpp b/radiant/preferences.cpp index 00723ab7..326702fb 100644 --- a/radiant/preferences.cpp +++ b/radiant/preferences.cpp @@ -614,7 +614,7 @@ void PreferencesDialog_addSettingsPage( const PreferenceGroupCallback& callback } void Widget_updateDependency( ui::Widget self, ui::Widget toggleButton ){ - gtk_widget_set_sensitive( self, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggleButton ) ) && GTK_WIDGET_IS_SENSITIVE( toggleButton ) ); + gtk_widget_set_sensitive( self, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( toggleButton ) ) && gtk_widget_is_sensitive( toggleButton ) ); } void ToggleButton_toggled_Widget_updateDependency( ui::Widget toggleButton, ui::Widget self ){ diff --git a/radiant/qe3.cpp b/radiant/qe3.cpp index d97a65ef..f458a079 100644 --- a/radiant/qe3.cpp +++ b/radiant/qe3.cpp @@ -333,14 +333,14 @@ bool g_bWaitCursor = false; void Sys_BeginWait( void ){ ScreenUpdates_Disable( "Processing...", "Please Wait" ); GdkCursor *cursor = gdk_cursor_new( GDK_WATCH ); - gdk_window_set_cursor( GTK_WIDGET( MainFrame_getWindow() )->window, cursor ); + gdk_window_set_cursor( gtk_widget_get_window(MainFrame_getWindow()), cursor ); gdk_cursor_unref( cursor ); g_bWaitCursor = true; } void Sys_EndWait( void ){ ScreenUpdates_Enable(); - gdk_window_set_cursor( GTK_WIDGET( MainFrame_getWindow() )->window, 0 ); + gdk_window_set_cursor(gtk_widget_get_window(MainFrame_getWindow()), 0 ); g_bWaitCursor = false; } diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index 245eb06d..a6ee307e 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -106,7 +106,7 @@ void queueDraw(){ inline void spin_button_set_step( GtkSpinButton* spin, gfloat step ){ #if 1 - gtk_spin_button_get_adjustment( spin )->step_increment = step; + gtk_adjustment_set_step_increment(gtk_spin_button_get_adjustment( spin ), step); #else GValue gvalue = GValue_default(); g_value_init( &gvalue, G_TYPE_DOUBLE ); @@ -210,7 +210,7 @@ void destroyWindow(){ Destroy(); } bool visible() const { - return GTK_WIDGET_VISIBLE( GetWidget() ); + return gtk_widget_get_visible( GetWidget() ); } void queueDraw(){ if ( visible() ) { @@ -1043,7 +1043,7 @@ ui::Window SurfaceInspector::BuildDialog(){ // --> Dunno, but this stuff may be necessary... (Looks like it!) gtk_widget_ref( TexTool::g_textoolWin ); gtk_widget_set_events( TexTool::g_textoolWin, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK ); - GTK_WIDGET_SET_FLAGS( TexTool::g_textoolWin, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( TexTool::g_textoolWin, true ); // <-- end stuff... gtk_widget_show( TexTool::g_textoolWin ); gtk_widget_set_usize( TexTool::g_textoolWin, -1, 240 ); //Yeah! @@ -1104,7 +1104,7 @@ void spin_button_set_value_no_signal( GtkSpinButton* spin, gdouble value ){ void spin_button_set_step_increment( GtkSpinButton* spin, gdouble value ){ GtkAdjustment* adjust = gtk_spin_button_get_adjustment( spin ); - adjust->step_increment = value; + gtk_adjustment_set_step_increment(adjust, value); } void SurfaceInspector::Update(){ diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp index f9f2b870..ab558113 100644 --- a/radiant/texwindow.cpp +++ b/radiant/texwindow.cpp @@ -166,7 +166,7 @@ void value_changed( gdouble value ){ } } static void adjustment_value_changed( GtkAdjustment *adjustment, DeferredAdjustment* self ){ - self->value_changed( adjustment->value ); + self->value_changed( gtk_adjustment_get_value(adjustment) ); } }; @@ -1357,7 +1357,7 @@ void TextureBrowser_scrollChanged( void* data, gdouble value ){ } static void TextureBrowser_verticalScroll( GtkAdjustment *adjustment, TextureBrowser* textureBrowser ){ - textureBrowser->m_scrollAdjustment.value_changed( adjustment->value ); + textureBrowser->m_scrollAdjustment.value_changed( gtk_adjustment_get_value(adjustment) ); } void TextureBrowser_updateScroll( TextureBrowser& textureBrowser ){ @@ -1368,12 +1368,12 @@ void TextureBrowser_updateScroll( TextureBrowser& textureBrowser ){ GtkAdjustment *vadjustment = gtk_range_get_adjustment( GTK_RANGE( textureBrowser.m_texture_scroll ) ); - vadjustment->value = -TextureBrowser_getOriginY( textureBrowser ); - vadjustment->page_size = textureBrowser.height; - vadjustment->page_increment = textureBrowser.height / 2; - vadjustment->step_increment = 20; - vadjustment->lower = 0; - vadjustment->upper = totalHeight; + gtk_adjustment_set_value(vadjustment, -TextureBrowser_getOriginY( textureBrowser )); + gtk_adjustment_set_page_size(vadjustment, textureBrowser.height); + gtk_adjustment_set_page_increment(vadjustment, textureBrowser.height / 2); + gtk_adjustment_set_step_increment(vadjustment, 20); + gtk_adjustment_set_lower(vadjustment, 0); + gtk_adjustment_set_upper(vadjustment, totalHeight); g_signal_emit_by_name( G_OBJECT( vadjustment ), "changed" ); } @@ -1995,7 +1995,7 @@ ui::Widget TextureBrowser_constructWindow( ui::Window toplevel ){ gtk_widget_ref( g_TextureBrowser.m_gl_widget ); gtk_widget_set_events( g_TextureBrowser.m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK ); - GTK_WIDGET_SET_FLAGS( g_TextureBrowser.m_gl_widget, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( g_TextureBrowser.m_gl_widget, true ); gtk_table_attach_defaults( GTK_TABLE( table ), g_TextureBrowser.m_gl_widget, 1, 2, 1, 2 ); gtk_widget_show( g_TextureBrowser.m_gl_widget ); diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index a4e91441..a20214da 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -707,7 +707,7 @@ bool XYWnd::chaseMouseMotion( int pointx, int pointy ){ Shader* XYWnd::m_state_selected = 0; void xy_update_xor_rectangle( XYWnd& self, rect_t area ){ - if ( GTK_WIDGET_VISIBLE( self.GetWidget() ) ) { + if ( gtk_widget_get_visible( self.GetWidget() ) ) { self.m_XORRectangle.set( rectangle_from_area( area.min, area.max, self.Width(), self.Height() ) ); } } @@ -831,7 +831,7 @@ XYWnd::XYWnd() : gtk_widget_ref( m_gl_widget ); gtk_widget_set_events( m_gl_widget, GDK_DESTROY | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK ); - GTK_WIDGET_SET_FLAGS( m_gl_widget, GTK_CAN_FOCUS ); + gtk_widget_set_can_focus( m_gl_widget, true ); m_sizeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "size_allocate", G_CALLBACK( xywnd_size_allocate ), this ); m_exposeHandler = g_signal_connect( G_OBJECT( m_gl_widget ), "expose_event", G_CALLBACK( xywnd_expose ), this ); @@ -946,12 +946,12 @@ void XYWnd::Clipper_Crosshair_OnMouseMoved( int x, int y ){ if ( ClipMode() && GlobalClipPoints_Find( mousePosition, (VIEWTYPE)m_viewType, m_fScale ) != 0 ) { GdkCursor *cursor; cursor = gdk_cursor_new( GDK_CROSSHAIR ); - gdk_window_set_cursor( GTK_WIDGET(m_gl_widget)->window, cursor ); + gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), cursor ); gdk_cursor_unref( cursor ); } else { - gdk_window_set_cursor( GTK_WIDGET(m_gl_widget)->window, 0 ); + gdk_window_set_cursor( gtk_widget_get_window(m_gl_widget), 0 ); } } @@ -1062,7 +1062,7 @@ void XYWnd::NewBrushDrag( int x, int y ){ void entitycreate_activated( ui::Widget item ){ scene::Node* world_node = Map_FindWorldspawn( g_map ); - const char* entity_name = gtk_label_get_text( GTK_LABEL( GTK_BIN( item )->child ) ); + const char* entity_name = gtk_label_get_text( GTK_LABEL( gtk_bin_get_child(GTK_BIN( item )) ) ); if ( !( world_node && string_equal( entity_name, "worldspawn" ) ) ) { g_pParentWnd->ActiveXY()->OnEntityCreate( entity_name );