diff --git a/xwords4/linux/Makefile b/xwords4/linux/Makefile index 54193daf8..fac5fb185 100644 --- a/xwords4/linux/Makefile +++ b/xwords4/linux/Makefile @@ -33,8 +33,10 @@ CFLAGS += -g $(GPROFFLAG) -Wall -Wunused-parameter -Wcast-align -Werror -O0 #CFLAGS += -Os -Werror -Wunused endif +# Getting ready for gtk 3.x CFLAGS += -DGTK_DISABLE_SINGLE_INCLUDES CFLAGS += -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED +CFLAGS += -DGSEAL_ENABLE BUILD_PLAT_DIR = $(BUILD_DIR)/$(PLATFORM) diff --git a/xwords4/linux/gtkaskdict.c b/xwords4/linux/gtkaskdict.c index d635d595b..289acc7d0 100644 --- a/xwords4/linux/gtkaskdict.c +++ b/xwords4/linux/gtkaskdict.c @@ -80,7 +80,8 @@ gtkaskdict( GSList* dicts, gchar* buf, gint buflen ) GtkWidget* dialog = gtk_dialog_new(); gtk_window_set_modal( GTK_WINDOW( dialog ), TRUE ); GtkWidget* list = gtk_tree_view_new(); - gtk_box_pack_start( GTK_BOX(GTK_DIALOG(dialog)->vbox), list, TRUE, TRUE, 5); + gtk_box_pack_start( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + list, TRUE, TRUE, 5); init_list( list ); @@ -96,7 +97,7 @@ gtkaskdict( GSList* dicts, gchar* buf, gint buflen ) GtkWidget* button = gtk_button_new_with_label( "Ok" ); g_signal_connect( GTK_OBJECT(button), "clicked", G_CALLBACK(on_clicked), NULL ); - gtk_box_pack_start( GTK_BOX(GTK_DIALOG(dialog)->vbox), button, + gtk_box_pack_start( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), button, FALSE, TRUE, 0 ); // gtk_widget_show( button ); diff --git a/xwords4/linux/gtkaskm.c b/xwords4/linux/gtkaskm.c index 3560c569b..37f18bac1 100644 --- a/xwords4/linux/gtkaskm.c +++ b/xwords4/linux/gtkaskm.c @@ -69,7 +69,8 @@ gtkaskm( const gchar* message, AskMInfo* infos, int nInfos ) gtk_box_pack_start( GTK_BOX(hbox), state.cancelButton, FALSE, TRUE, 0 ); gtk_box_pack_start( GTK_BOX(vbox), hbox, FALSE, TRUE, 0 ); - gtk_container_add( GTK_CONTAINER( GTK_DIALOG(dialog)->action_area), vbox); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), + vbox); gtk_widget_show_all( dialog ); gtk_main(); diff --git a/xwords4/linux/gtkboard.c b/xwords4/linux/gtkboard.c index d437d232b..8e4a2505e 100644 --- a/xwords4/linux/gtkboard.c +++ b/xwords4/linux/gtkboard.c @@ -705,10 +705,11 @@ configure_event( GtkWidget* widget, GdkEventConfigure* XP_UNUSED(event), CommonGlobals* cGlobals = &globals->cGlobals; BoardCtxt* board = cGlobals->game.board; - short bdWidth = widget->allocation.width - (GTK_RIGHT_MARGIN - + GTK_BOARD_LEFT_MARGIN); - short bdHeight = widget->allocation.height - (GTK_TOP_MARGIN + GTK_BOTTOM_MARGIN) - - GTK_MIN_TRAY_SCALEV - GTK_BOTTOM_MARGIN; + GtkAllocation alloc; + gtk_widget_get_allocation( widget, &alloc ); + short bdWidth = alloc.width - (GTK_RIGHT_MARGIN + GTK_BOARD_LEFT_MARGIN); + short bdHeight = alloc.height - (GTK_TOP_MARGIN + GTK_BOTTOM_MARGIN) + - GTK_MIN_TRAY_SCALEV - GTK_BOTTOM_MARGIN; #ifdef COMMON_LAYOUT XP_ASSERT( !cGlobals->params->verticalScore ); /* not supported */ @@ -1549,7 +1550,7 @@ static void scroll_value_changed( GtkAdjustment *adj, GtkGameGlobals* globals ) { XP_U16 newValue; - gfloat newValueF = adj->value; + gfloat newValueF = gtk_adjustment_get_value( adj ); /* XP_ASSERT( newValueF >= 0.0 */ /* && newValueF <= globals->cGlobals.params->nHidden ); */ @@ -1577,8 +1578,8 @@ handle_hide_button( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals ) if ( globals->cGlobals.params->nHidden > 0 ) { gint nRows = globals->cGlobals.gi->boardSize; - globals->adjustment->page_size = nRows; - globals->adjustment->value = 0.0; + gtk_adjustment_set_page_size( globals->adjustment, nRows ); + gtk_adjustment_set_value( globals->adjustment, 0.0 ); g_signal_emit_by_name( GTK_OBJECT(globals->adjustment), "changed" ); gtk_adjustment_value_changed( GTK_ADJUSTMENT(globals->adjustment) ); @@ -1814,9 +1815,9 @@ gtk_util_yOffsetChange( XW_UtilCtxt* uc, XP_U16 maxOffset, GtkGameGlobals* globals = (GtkGameGlobals*)uc->closure; if ( !!globals->adjustment ) { gint nRows = globals->cGlobals.gi->boardSize; - globals->adjustment->page_size = nRows - maxOffset; - globals->adjustment->value = newOffset; - gtk_adjustment_value_changed( GTK_ADJUSTMENT(globals->adjustment) ); + gtk_adjustment_set_page_size(globals->adjustment, nRows - maxOffset); + gtk_adjustment_set_value(globals->adjustment, newOffset); + gtk_adjustment_value_changed( globals->adjustment ); } } /* gtk_util_yOffsetChange */ diff --git a/xwords4/linux/gtkconnsdlg.c b/xwords4/linux/gtkconnsdlg.c index 029cd6b33..77289ddc0 100644 --- a/xwords4/linux/gtkconnsdlg.c +++ b/xwords4/linux/gtkconnsdlg.c @@ -408,7 +408,7 @@ gtkConnsDlg( GtkGameGlobals* globals, CommsAddrRec* addr, DeviceRole role, dialog = gtk_dialog_new(); gtk_window_set_modal( GTK_WINDOW( dialog ), TRUE ); - gtk_container_add( GTK_CONTAINER( GTK_DIALOG(dialog)->action_area), vbox ); + gtk_container_add( GTK_CONTAINER( gtk_dialog_get_action_area(GTK_DIALOG(dialog))), vbox ); gtk_widget_show_all( dialog ); gtk_main(); diff --git a/xwords4/linux/gtkdraw.c b/xwords4/linux/gtkdraw.c index 0f97ef289..c39226ce7 100644 --- a/xwords4/linux/gtkdraw.c +++ b/xwords4/linux/gtkdraw.c @@ -64,7 +64,7 @@ gtkInsetRect( XP_Rect* r, short i ) #if 0 #define DRAW_WHAT(dc) ((dc)->globals->pixmap) #else -#define DRAW_WHAT(dc) ((dc)->drawing_area->window) +#define DRAW_WHAT(dc) (gtk_widget_get_window((dc)->drawing_area)) #endif #define GTKMIN_W_HT 12 @@ -126,8 +126,8 @@ static void gtkEraseRect( const GtkDrawCtx* dctx, const XP_Rect* rect ) { set_color_cairo( dctx, 0xFFFF, 0xFFFF, 0xFFFF ); - draw_rectangle( dctx, DRAW_WHAT(dctx), - dctx->drawing_area->style->white_gc, + const GtkStyle* style = gtk_widget_get_style( dctx->drawing_area ); + draw_rectangle( dctx, DRAW_WHAT(dctx), style->white_gc, TRUE, rect->left, rect->top, rect->width, rect->height ); } /* gtkEraseRect */ @@ -286,6 +286,7 @@ drawBitmapFromLBS( GtkDrawCtx* dctx, const XP_Bitmap bm, const XP_Rect* rect ) XP_U16 i; XP_S16 nBytes; XP_U16 nCols, nRows; + const GtkStyle* style = gtk_widget_get_style( dctx->drawing_area ); nCols = lbs->nCols; nRows = lbs->nRows; @@ -293,8 +294,7 @@ drawBitmapFromLBS( GtkDrawCtx* dctx, const XP_Bitmap bm, const XP_Rect* rect ) nBytes = lbs->nBytes; pm = gdk_pixmap_new( DRAW_WHAT(dctx), nCols, nRows, -1 ); - - draw_rectangle( dctx, pm, dctx->drawing_area->style->white_gc, TRUE, + draw_rectangle( dctx, pm, style->white_gc, TRUE, 0, 0, nCols, nRows ); x = 0; @@ -307,7 +307,7 @@ drawBitmapFromLBS( GtkDrawCtx* dctx, const XP_Bitmap bm, const XP_Rect* rect ) if ( draw ) { #ifdef USE_CAIRO #else - gdk_draw_point( pm, dctx->drawing_area->style->black_gc, x, y ); + gdk_draw_point( pm, style->black_gc, x, y ); #endif } byte <<= 1; @@ -349,12 +349,12 @@ static void gtk_draw_destroyCtxt( DrawCtx* p_dctx ) { GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; - GtkAllocation* alloc = &dctx->drawing_area->allocation; + GtkAllocation alloc; + gtk_widget_get_allocation( dctx->drawing_area, &alloc ); + const GtkStyle* style = gtk_widget_get_style( dctx->drawing_area ); - draw_rectangle( dctx, DRAW_WHAT(dctx), - dctx->drawing_area->style->white_gc, - TRUE, - 0, 0, alloc->width, alloc->height ); + draw_rectangle( dctx, DRAW_WHAT(dctx), style->white_gc, TRUE, + 0, 0, alloc.width, alloc.height ); g_list_foreach( dctx->fontsPerSize, freer, NULL ); g_list_free( dctx->fontsPerSize ); @@ -1387,7 +1387,7 @@ gtkDrawCtxtMake( GtkWidget* drawing_area, GtkGameGlobals* globals ) /* } else { */ /* window = GTK_WIDGET(drawing_area)->window; */ /* } */ - GdkWindow* window = GTK_WIDGET(drawing_area)->window; + GdkWindow* window = gtk_widget_get_window(drawing_area); XP_ASSERT( !!window ); #ifdef USE_CAIRO dctx->cr = gdk_cairo_create( window ); diff --git a/xwords4/linux/gtkinvit.c b/xwords4/linux/gtkinvit.c index 6bb800dfd..32266513c 100644 --- a/xwords4/linux/gtkinvit.c +++ b/xwords4/linux/gtkinvit.c @@ -365,8 +365,7 @@ gtkInviteDlg( GtkGameGlobals* globals, CommsAddrRec* addr, dialog = gtk_dialog_new(); gtk_window_set_modal( GTK_WINDOW( dialog ), TRUE ); - gtk_container_add( GTK_CONTAINER( GTK_DIALOG(dialog)->action_area), vbox ); - + gtk_container_add( GTK_CONTAINER( gtk_dialog_get_action_area(GTK_DIALOG(dialog))), vbox ); gtk_widget_show_all( dialog ); gtk_main(); diff --git a/xwords4/linux/gtkletterask.c b/xwords4/linux/gtkletterask.c index 20a99b020..db4aa80b9 100644 --- a/xwords4/linux/gtkletterask.c +++ b/xwords4/linux/gtkletterask.c @@ -111,7 +111,7 @@ gtkletterask( const PickInfo* pi, XP_Bool forTray, const XP_UCHAR* name, txt = "Choose a letter for your blank."; } label = gtk_label_new( txt ); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), + gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), label); if ( forTray ) { @@ -124,11 +124,11 @@ gtkletterask( const PickInfo* pi, XP_Bool forTray, const XP_UCHAR* name, } GtkWidget* curTilesLabel = gtk_label_new( curTilesBuf ); - gtk_container_add( GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), + gtk_container_add( GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG(dialog))), curTilesLabel ); } - gtk_container_add( GTK_CONTAINER( GTK_DIALOG(dialog)->action_area), vbox); + gtk_container_add( GTK_CONTAINER( gtk_dialog_get_action_area(GTK_DIALOG(dialog))), vbox); gtk_widget_show_all( dialog ); gtk_main(); diff --git a/xwords4/linux/gtknewgame.c b/xwords4/linux/gtknewgame.c index 98171a788..2fbd42434 100644 --- a/xwords4/linux/gtknewgame.c +++ b/xwords4/linux/gtknewgame.c @@ -395,7 +395,7 @@ makeNewGameDialog( GtkNewGameState* state ) gtk_box_pack_start( GTK_BOX(vbox), hbox, FALSE, TRUE, 0 ); gtk_widget_show( vbox ); - gtk_container_add( GTK_CONTAINER( GTK_DIALOG(dialog)->action_area), vbox); + gtk_container_add( GTK_CONTAINER( gtk_dialog_get_action_area(GTK_DIALOG(dialog))), vbox); gtk_widget_show_all (dialog); diff --git a/xwords4/linux/gtkntilesask.c b/xwords4/linux/gtkntilesask.c index 763982182..8602c8b62 100644 --- a/xwords4/linux/gtkntilesask.c +++ b/xwords4/linux/gtkntilesask.c @@ -48,8 +48,8 @@ askNTiles( XP_U16 max, XP_U16 deflt ) sprintf( defbuf, "Limit hint to how many tiles (deflt=%d)?", deflt ); label = gtk_label_new( defbuf ); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), - label); + gtk_container_add( GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + label ); hbox = gtk_hbox_new( FALSE, 0 ); for ( i = 0; i < max; ++i ) { @@ -65,13 +65,13 @@ askNTiles( XP_U16 max, XP_U16 deflt ) gtk_widget_show( button ); } gtk_widget_show( hbox ); - gtk_box_pack_start( GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, - FALSE, TRUE, 0 ); + + GtkWidget* dlgVBox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); + gtk_box_pack_start( GTK_BOX(dlgVBox), hbox, FALSE, TRUE, 0 ); sprintf( defbuf, "Default (%d)", deflt ); button = gtk_button_new_with_label( defbuf ); - gtk_box_pack_start( GTK_BOX(GTK_DIALOG(dialog)->vbox), button, FALSE, - TRUE, 0 ); + gtk_box_pack_start( GTK_BOX(dlgVBox), button, FALSE, TRUE, 0 ); g_signal_connect( GTK_OBJECT(button), "clicked", G_CALLBACK(button_event), &results[deflt-1] ); diff --git a/xwords4/linux/gtkpasswdask.c b/xwords4/linux/gtkpasswdask.c index 3dd81af44..501a76e5d 100644 --- a/xwords4/linux/gtkpasswdask.c +++ b/xwords4/linux/gtkpasswdask.c @@ -52,8 +52,8 @@ gtkpasswdask( const char* name, char* outbuf, XP_U16* buflen ) snprintf( buf, sizeof(buf), "Password for player \"%s\"", name ); label = gtk_label_new( buf ); - gtk_container_add( GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), - label ); + gtk_container_add( GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + label); /* we need a text field and two buttons as well */ vbox = gtk_vbox_new(FALSE, 0); @@ -75,7 +75,7 @@ gtkpasswdask( const char* name, char* outbuf, XP_U16* buflen ) gtk_box_pack_start( GTK_BOX(vbox), hbox, FALSE, TRUE, 0 ); - gtk_container_add( GTK_CONTAINER( GTK_DIALOG(dialog)->action_area), vbox); + gtk_container_add( GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))), vbox); gtk_widget_show_all( dialog );