Hi,
is there any reason for not updating to GTK 3.0+ (other than there was no need or time :-) Best, Jan _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
On 09/04/2015 13:01, Jan Vrany wrote: > Hi, > > is there any reason for not updating to GTK 3.0+ > (other than there was no need or time :-) No time, basically. Paolo _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
On Thu, 2015-04-09 at 14:01 +0200, Paolo Bonzini wrote:
> > On 09/04/2015 13:01, Jan Vrany wrote: > > Hi, > > > > is there any reason for not updating to GTK 3.0+ > > (other than there was no need or time :-) > > No time, basically. > OK, here's my attempt (also https://github.com/janvrany/gst/commits/feature-gtk3) It compiles fine on my box and even runs gtk examples found in GST repo, but crashes when trying to run VisualGST: (gst:18774): GLib-GObject-WARNING **: cannot register existing type 'GtkWidget' (ip 16)CFunctionDescriptor(CCallable)>>#callInto: (ip 8)GtkToolButton class>>#newFromStock: (ip 10)GtkLauncher>>#createToolbar (ip 32)GtkLauncher(GtkMainWindow)>>#initialize (ip 48)GtkLauncher>>#initialize (ip 12)GtkLauncher class>>#createInstance (ip 2)[] in GtkLauncher class>>#uniqueInstance (ip 6)UndefinedObject>>#ifNil: (ip 8)GtkLauncher class>>#uniqueInstance (ip 4)GtkLauncher class>>#open (ip 4)UndefinedObject>>#executeStatements (ip 0)<bottom> I have no clue what's wrong. Does anybody have an idea? Best, Jan here's my attempt. From cea25f52803f120734b901db213edcffd6697075 Mon Sep 17 00:00:00 2001 From: Jan Vrany <[hidden email]> Date: Thu, 9 Apr 2015 12:04:10 +0100 Subject: [PATCH 1/2] gtk: Updated to GTK 2.20 and newer. GTK code has been updated to use API functions available in GTK 2.20 and newer. This results in simpler code and paves road toward GTK 3.0. 2015-04-15 Jan Vrany <[hidden email]> * packages/gtk/gst-gtk.c: Removed a number of accessors as newer GTK have them * packages/gtk/placer.c: Replaced direct access to GTK widget properties by accessor functions when possible. Avoid usage of GTK_WIDGET_SET_FLAGS()/GTK_WIDGET_GET_FLAGS(), replace by calling corresponding API functions. * packages/gtk/MoreFuncs.st: Removed call-outs to gst-specific accessors that used to be defined in gst-gtk.c as they are no longer needed. --- configure.ac | 2 +- packages/gtk/ChangeLog | 14 +++++++++ packages/gtk/MoreFuncs.st | 22 ++++---------- packages/gtk/gst-gtk.c | 50 -------------------------------- packages/gtk/placer.c | 73 +++++++++++++++++++++-------------------------- 5 files changed, 53 insertions(+), 108 deletions(-) diff --git a/configure.ac b/configure.ac index bfd09a4..c7f2f18 100644 --- a/configure.ac +++ b/configure.ac @@ -490,7 +490,7 @@ GST_PACKAGE_ENABLE([GTK], [gtk], [ if test "$enable_gtk" != no && test "$gst_cv_glib" != no; then maybe_enable_gtk=$enable_gtk enable_gtk=no - AM_PATH_GTK_2_0(2.0.0, + AM_PATH_GTK_2_0(2.20.0, [PKG_CHECK_MODULES(ATK, atk >= 1.0.0, [PKG_CHECK_MODULES(PANGO, pango >= 1.0.0, [enable_gtk=$maybe_enable_gtk], :)], [:])]) diff --git a/packages/gtk/ChangeLog b/packages/gtk/ChangeLog index 25d19f8..abcfe39 100644 --- a/packages/gtk/ChangeLog +++ b/packages/gtk/ChangeLog @@ -1,3 +1,17 @@ +2015-04-15 Jan Vrany <[hidden email]> + + Updated to GTK 2.20+ + + * gst-gtk.c: Removed a number of accessors as newer GTK + have them + * placer.c: Replaced direct access to GTK widget properties + by accessor functions when possible. Avoid usage of + GTK_WIDGET_SET_FLAGS()/GTK_WIDGET_GET_FLAGS(), replace + by calling corresponding API functions. + * MoreFuncs.st: Removed call-outs to gst-specific accessors + that used to be defined in gst-gtk.c as they are no longer + needed. + 2013-08-24 Holger Hans Peter Freyther <[hidden email]> * mk_enums.awk: Use #ifdef/#endif around key definition. diff --git a/packages/gtk/MoreFuncs.st b/packages/gtk/MoreFuncs.st index feee6ee..a4a0585 100644 --- a/packages/gtk/MoreFuncs.st +++ b/packages/gtk/MoreFuncs.st @@ -88,14 +88,11 @@ GtkWidget extend [ getAllocation [ <category: 'C call-outs'> - <cCall: 'gstGtkWidgetGetAllocation' returning: #{GtkAllocation} - args: #(#self )> + | allocation | - ] - - getWindow [ - <category: 'C call-outs'> - <cCall: 'gstGtkGetWindow' returning: #{GdkWindow} args: #(#self )> + allocation := GtkAllocation new. + self getAllocation: allocation. + ^ allocation ] @@ -189,16 +186,7 @@ GtkListStore extend [ GtkDialog extend [ getVBox [ - <category: 'C call-outs'> - <cCall: 'gstGtkDialogGetVBox' returning: #{GtkWidget} args: #(#self )> - - ] - - getActionArea [ - <category: 'C call-outs'> - <cCall: 'gstGtkDialogGetActionArea' returning: #{GtkWidget} - args: #(#self )> - + ^self getContentArea ] ] diff --git a/packages/gtk/gst-gtk.c b/packages/gtk/gst-gtk.c index 912be1d..9a29c21 100644 --- a/packages/gtk/gst-gtk.c +++ b/packages/gtk/gst-gtk.c @@ -207,12 +207,6 @@ tree_store_set_oop (GtkTreeStore *store, /* Wrappers for macros and missing accessor functions. */ -static GdkWindow * -widget_get_window (GtkWidget *widget) -{ - return widget->window; -} - static int widget_get_state (GtkWidget *widget) { @@ -237,25 +231,6 @@ widget_unset_flags (GtkWidget *widget, int flags) GTK_WIDGET_UNSET_FLAGS (widget, flags); } - -static GtkAllocation * -widget_get_allocation (GtkWidget *wgt) -{ - return &(GTK_WIDGET(wgt)->allocation); -} - -static GtkWidget * -dialog_get_vbox (GtkDialog *dlg) -{ - return (GTK_DIALOG(dlg)->vbox); -} - -static GtkWidget * -dialog_get_action_area (GtkDialog *dlg) -{ - return (GTK_DIALOG(dlg)->action_area); -} - static int scrolled_window_get_hscrollbar_visible (GtkScrolledWindow *swnd) { @@ -268,24 +243,6 @@ scrolled_window_get_vscrollbar_visible (GtkScrolledWindow *swnd) return (GTK_SCROLLED_WINDOW(swnd)->vscrollbar_visible); } -static int -adjustment_get_lower (GtkAdjustment *adj) -{ - return (GTK_ADJUSTMENT(adj)->lower); -} - -static int -adjustment_get_upper (GtkAdjustment *adj) -{ - return (GTK_ADJUSTMENT(adj)->upper); -} - -static int -adjustment_get_page_size (GtkAdjustment *adj) -{ - return (GTK_ADJUSTMENT(adj)->page_size); -} - /* Initialization. */ static int initialized = 0; @@ -315,18 +272,11 @@ gst_initModule (proxy) _gtk_vm_proxy->defineCFunc ("gstGtkGetFlags", widget_get_flags); _gtk_vm_proxy->defineCFunc ("gstGtkSetFlags", widget_set_flags); _gtk_vm_proxy->defineCFunc ("gstGtkUnsetFlags", widget_unset_flags); - _gtk_vm_proxy->defineCFunc ("gstGtkGetWindow", widget_get_window); _gtk_vm_proxy->defineCFunc ("gstGtkGetHscrollbarVisible", scrolled_window_get_hscrollbar_visible); _gtk_vm_proxy->defineCFunc ("gstGtkGetVscrollbarVisible", scrolled_window_get_vscrollbar_visible); - _gtk_vm_proxy->defineCFunc ("gstGtkAdjustmentGetLower", adjustment_get_lower); - _gtk_vm_proxy->defineCFunc ("gstGtkAdjustmentGetUpper", adjustment_get_upper); - _gtk_vm_proxy->defineCFunc ("gstGtkAdjustmentGetPageSize", adjustment_get_page_size); _gtk_vm_proxy->defineCFunc ("gstGtkTreeModelGetOOP", tree_model_get_oop); _gtk_vm_proxy->defineCFunc ("gstGtkListStoreSetOOP", list_store_set_oop); _gtk_vm_proxy->defineCFunc ("gstGtkTreeStoreSetOOP", tree_store_set_oop); - _gtk_vm_proxy->defineCFunc ("gstGtkWidgetGetAllocation", widget_get_allocation); - _gtk_vm_proxy->defineCFunc ("gstGtkDialogGetVBox", dialog_get_vbox); - _gtk_vm_proxy->defineCFunc ("gstGtkDialogGetActionArea", dialog_get_action_area); _gtk_vm_proxy->defineCFunc ("gtk_placer_get_type", gtk_placer_get_type); _gtk_vm_proxy->defineCFunc ("gtk_placer_new", gtk_placer_new); diff --git a/packages/gtk/placer.c b/packages/gtk/placer.c index 074428a..d019ef1 100644 --- a/packages/gtk/placer.c +++ b/packages/gtk/placer.c @@ -236,8 +236,7 @@ gtk_placer_child_type (GtkContainer *container) static void gtk_placer_init (GtkPlacer *placer) { - GTK_WIDGET_SET_FLAGS (placer, GTK_NO_WINDOW); - + gtk_widget_set_has_window(GTK_WIDGET(placer), FALSE); placer->children = NULL; } @@ -329,7 +328,7 @@ gtk_placer_move_internal (GtkPlacer *placer, g_return_if_fail (GTK_IS_PLACER (placer)); g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (widget->parent == GTK_WIDGET (placer)); + g_return_if_fail (gtk_widget_get_parent(GTK_WIDGET(widget)) == GTK_WIDGET (placer)); g_return_if_fail (!change_rel_x || (rel_x & ~32767) == 0); g_return_if_fail (!change_rel_y || (rel_y & ~32767) == 0); g_return_if_fail (!change_rel_width || (rel_width & ~32767) == 0); @@ -391,7 +390,7 @@ gtk_placer_move_internal (GtkPlacer *placer, gtk_widget_thaw_child_notify (widget); - if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (placer)) + if (gtk_widget_get_visible (GTK_WIDGET(widget)) && gtk_widget_get_visible (GTK_WIDGET(placer))) gtk_widget_queue_resize (GTK_WIDGET (placer)); } @@ -530,34 +529,39 @@ gtk_placer_get_child_property (GtkContainer *container, static void gtk_placer_realize (GtkWidget *widget) { + GdkWindow *window; GdkWindowAttr attributes; + GtkAllocation allocation; gint attributes_mask; - if (GTK_WIDGET_NO_WINDOW (widget)) + if (!gtk_widget_get_has_window (widget)) GTK_WIDGET_CLASS (parent_class)->realize (widget); else { - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); + gtk_widget_set_realized(widget, TRUE); + gtk_widget_get_allocation(widget, &allocation); attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = widget->allocation.x; - attributes.y = widget->allocation.y; - attributes.width = widget->allocation.width; - attributes.height = widget->allocation.height; + attributes.x = allocation.x; + attributes.y = allocation.y; + attributes.width = allocation.width; + attributes.height = allocation.height; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); + attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, - attributes_mask); - gdk_window_set_user_data (widget->window, widget); - - widget->style = gtk_style_attach (widget->style, widget->window); - gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); + window = gdk_window_new (gtk_widget_get_parent_window (widget), + &attributes, + attributes_mask); + gtk_widget_set_window(widget, window); + gdk_window_set_user_data (window, widget); + gtk_widget_style_attach (widget); + gtk_style_set_background (gtk_widget_get_style(widget), window, GTK_STATE_NORMAL); } } @@ -573,7 +577,7 @@ gtk_placer_size_request (GtkWidget *widget, gint height, width; placer = GTK_PLACER (widget); - border_width = GTK_CONTAINER (placer)->border_width; + border_width = gtk_container_get_border_width(GTK_CONTAINER (placer)); requisition->width = 0; requisition->height = 0; @@ -583,7 +587,7 @@ gtk_placer_size_request (GtkWidget *widget, child = children->data; children = children->next; - if (GTK_WIDGET_VISIBLE (child->widget)) + if (gtk_widget_get_visible (child->widget)) { gtk_widget_size_request (child->widget, &child_requisition); @@ -638,19 +642,19 @@ gtk_placer_size_allocate (GtkWidget *widget, placer = GTK_PLACER (widget); - widget->allocation = *allocation; + gtk_widget_set_allocation(widget, allocation); - if (!GTK_WIDGET_NO_WINDOW (widget)) + if (gtk_widget_get_has_window (widget)) { - if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize (widget->window, + if (gtk_widget_get_realized (widget)) + gdk_window_move_resize (gtk_widget_get_window(widget), allocation->x, allocation->y, allocation->width, allocation->height); } - border_width = GTK_CONTAINER (placer)->border_width; + border_width = gtk_container_get_border_width(GTK_CONTAINER (placer)); rel_width_scale = (allocation->width - 2 * border_width) / 32767.0; rel_height_scale = (allocation->height - 2 * border_width) / 32767.0; @@ -660,7 +664,7 @@ gtk_placer_size_allocate (GtkWidget *widget, child = children->data; children = children->next; - if (GTK_WIDGET_VISIBLE (child->widget)) + if (gtk_widget_get_visible (child->widget)) { gtk_widget_get_child_requisition (child->widget, &child_requisition); child_allocation.x = child->x + border_width @@ -668,7 +672,7 @@ gtk_placer_size_allocate (GtkWidget *widget, child_allocation.y = child->y + border_width + child->rel_y * rel_height_scale; - if (GTK_WIDGET_NO_WINDOW (widget)) + if (!gtk_widget_get_has_window (widget)) { child_allocation.x += allocation->x; child_allocation.y += allocation->y; @@ -718,7 +722,7 @@ gtk_placer_remove (GtkContainer *container, if (child->widget == widget) { - gboolean was_visible = GTK_WIDGET_VISIBLE (widget); + gboolean was_visible = gtk_widget_get_visible (widget); gtk_widget_unparent (widget); @@ -726,7 +730,7 @@ gtk_placer_remove (GtkContainer *container, g_list_free (children); g_free (child); - if (was_visible && GTK_WIDGET_VISIBLE (container)) + if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container))) gtk_widget_queue_resize (GTK_WIDGET (container)); break; @@ -775,16 +779,7 @@ void gtk_placer_set_has_window (GtkPlacer *placer, gboolean has_window) { - g_return_if_fail (GTK_IS_PLACER (placer)); - g_return_if_fail (!GTK_WIDGET_REALIZED (placer)); - - if (!has_window != GTK_WIDGET_NO_WINDOW (placer)) - { - if (has_window) - GTK_WIDGET_UNSET_FLAGS (placer, GTK_NO_WINDOW); - else - GTK_WIDGET_SET_FLAGS (placer, GTK_NO_WINDOW); - } + gtk_widget_set_has_window (GTK_WIDGET(placer), has_window); } /** @@ -799,7 +794,5 @@ gtk_placer_set_has_window (GtkPlacer *placer, gboolean gtk_placer_get_has_window (GtkPlacer *placer) { - g_return_val_if_fail (GTK_IS_PLACER (placer), FALSE); - - return !GTK_WIDGET_NO_WINDOW (placer); + return gtk_widget_get_has_window (GTK_WIDGET(placer)); } -- 2.1.4 From c59725e3dcec4950ee698fa6ce917b98b49419ef Mon Sep 17 00:00:00 2001 From: Jan Vrany <[hidden email]> Date: Wed, 15 Apr 2015 12:04:01 +0100 Subject: [PATCH 2/2] gtk: Updated to GTK 3.10 and newer. All examples works but VisualGST crashes: Loading package GLib Loading package Cairo "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" "Global garbage collection... done, heap grown" Loading package Parser Loading package SUnit Loading package DebugTools Loading package Announcements "Global garbage collection... done, heap grown" Packages loaded... (gst:18774): GLib-GObject-WARNING **: cannot register existing type 'GtkWidget' (ip 16)CFunctionDescriptor(CCallable)>>#callInto: (ip 8)GtkToolButton class>>#newFromStock: (ip 10)GtkLauncher>>#createToolbar (ip 32)GtkLauncher(GtkMainWindow)>>#initialize (ip 48)GtkLauncher>>#initialize (ip 12)GtkLauncher class>>#createInstance (ip 2)[] in GtkLauncher class>>#uniqueInstance (ip 6)UndefinedObject>>#ifNil: (ip 8)GtkLauncher class>>#uniqueInstance (ip 4)GtkLauncher class>>#open (ip 4)UndefinedObject>>#executeStatements (ip 0)<bottom> (gst:18774): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed (ip 16)CFunctionDescriptor(CCallable)>>#callInto: (ip 8)GtkToolButton class>>#newFromStock: (ip 10)GtkLauncher>>#createToolbar (ip 32)GtkLauncher(GtkMainWindow)>>#initialize (ip 48)GtkLauncher>>#initialize (ip 12)GtkLauncher class>>#createInstance (ip 2)[] in GtkLauncher class>>#uniqueInstance (ip 6)UndefinedObject>>#ifNil: (ip 8)GtkLauncher class>>#uniqueInstance (ip 4)GtkLauncher class>>#open (ip 4)UndefinedObject>>#executeStatements (ip 0)<bottom> (gst:18774): GLib-GObject-WARNING **: cannot register existing type 'GtkBuildable' (ip 16)CFunctionDescriptor(CCallable)>>#callInto: (ip 8)GtkToolButton class>>#newFromStock: (ip 10)GtkLauncher>>#createToolbar (ip 32)GtkLauncher(GtkMainWindow)>>#initialize (ip 48)GtkLauncher>>#initialize (ip 12)GtkLauncher class>>#createInstance (ip 2)[] in GtkLauncher class>>#uniqueInstance (ip 6)UndefinedObject>>#ifNil: (ip 8)GtkLauncher class>>#uniqueInstance (ip 4)GtkLauncher class>>#open (ip 4)UndefinedObject>>#executeStatements (ip 0)<bottom> (gst:18774): GLib-GObject-CRITICAL **: g_type_interface_add_prerequisite: assertion 'G_TYPE_IS_INTERFACE (interface_type)' failed (ip 16)CFunctionDescriptor(CCallable)>>#callInto: (ip 8)GtkToolButton class>>#newFromStock: (ip 10)GtkLauncher>>#createToolbar (ip 32)GtkLauncher(GtkMainWindow)>>#initialize (ip 48)GtkLauncher>>#initialize (ip 12)GtkLauncher class>>#createInstance (ip 2)[] in GtkLauncher class>>#uniqueInstance (ip 6)UndefinedObject>>#ifNil: (ip 8)GtkLauncher class>>#uniqueInstance (ip 4)GtkLauncher class>>#open (ip 4)UndefinedObject>>#executeStatements (ip 0)<bottom> (gst:18774): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed (ip 16)CFunctionDescriptor(CCallable)>>#callInto: (ip 8)GtkToolButton class>>#newFromStock: (ip 10)GtkLauncher>>#createToolbar (ip 32)GtkLauncher(GtkMainWindow)>>#initialize (ip 48)GtkLauncher>>#initialize (ip 12)GtkLauncher class>>#createInstance (ip 2)[] in GtkLauncher class>>#uniqueInstance (ip 6)UndefinedObject>>#ifNil: (ip 8)GtkLauncher class>>#uniqueInstance (ip 4)GtkLauncher class>>#open (ip 4)UndefinedObject>>#executeStatements (ip 0)<bottom> (gst:18774): GLib-GObject-CRITICAL **: g_type_add_interface_static: assertion 'G_TYPE_IS_INSTANTIATABLE (instance_type)' failed (ip 16)CFunctionDescriptor(CCallable)>>#callInto: (ip 8)GtkToolButton class>>#newFromStock: (ip 10)GtkLauncher>>#createToolbar (ip 32)GtkLauncher(GtkMainWindow)>>#initialize (ip 48)GtkLauncher>>#initialize (ip 12)GtkLauncher class>>#createInstance (ip 2)[] in GtkLauncher class>>#uniqueInstance (ip 6)UndefinedObject>>#ifNil: (ip 8)GtkLauncher class>>#uniqueInstance (ip 4)GtkLauncher class>>#open (ip 4)UndefinedObject>>#executeStatements (ip 0)<bottom> (gst:18774): GLib-GObject-CRITICAL **: g_type_register_static: assertion 'parent_type > 0' failed (ip 16)CFunctionDescriptor(CCallable)>>#callInto: (ip 8)GtkToolButton class>>#newFromStock: (ip 10)GtkLauncher>>#createToolbar (ip 32)GtkLauncher(GtkMainWindow)>>#initialize (ip 48)GtkLauncher>>#initialize (ip 12)GtkLauncher class>>#createInstance (ip 2)[] in GtkLauncher class>>#uniqueInstance (ip 6)UndefinedObject>>#ifNil: (ip 8)GtkLauncher class>>#uniqueInstance (ip 4)GtkLauncher class>>#open (ip 4)UndefinedObject>>#executeStatements (ip 0)<bottom> No clue why... 2015-04-15 Jan Vrany <[hidden email]> * gst-gtk.c: Removed (now) obsolete scrolled_window_get_hscrollbar_visible() and scrolled_window_get_vscrollbar_visible() * placer.c: Updated to GTK 3.0 API * structs.awk: Removed GtkObject and GdkDrawable,- they're gone in GTK 3.0 * funcs.awk: Makde gdk_window_*() functions to belong to GdkWindow and not to GdkDrawable (which is gone) * MoreFuncs.st: Removed extensions for GtkObject (it's gone) and callouts in GtkScrolledWindow (GTK 3.0 provides accessors) * GtkImpl.st: Removed extensios to GdkRectangle which is an alias to cairo_rectangle_int_t in GTK 3.0. Moved extensions of (now gone) GdkDrawable to GdkWindow --- configure.ac | 4 +- packages/gtk/ChangeLog | 17 ++++++++ packages/gtk/GtkImpl.st | 98 +---------------------------------------------- packages/gtk/MoreFuncs.st | 57 ++------------------------- packages/gtk/funcs.awk | 4 +- packages/gtk/gst-gtk.c | 14 ------- packages/gtk/placer.c | 34 ++++++++++++++-- packages/gtk/structs.awk | 11 ++++-- 8 files changed, 62 insertions(+), 177 deletions(-) diff --git a/configure.ac b/configure.ac index c7f2f18..b5415ab 100644 --- a/configure.ac +++ b/configure.ac @@ -490,8 +490,8 @@ GST_PACKAGE_ENABLE([GTK], [gtk], [ if test "$enable_gtk" != no && test "$gst_cv_glib" != no; then maybe_enable_gtk=$enable_gtk enable_gtk=no - AM_PATH_GTK_2_0(2.20.0, - [PKG_CHECK_MODULES(ATK, atk >= 1.0.0, + AM_PATH_GTK_3_0(3.10.0, + [PKG_CHECK_MODULES(ATK, atk >= 2.12.0, [PKG_CHECK_MODULES(PANGO, pango >= 1.0.0, [enable_gtk=$maybe_enable_gtk], :)], [:])]) fi], diff --git a/packages/gtk/ChangeLog b/packages/gtk/ChangeLog index abcfe39..d308781 100644 --- a/packages/gtk/ChangeLog +++ b/packages/gtk/ChangeLog @@ -1,5 +1,22 @@ 2015-04-15 Jan Vrany <[hidden email]> + Updated to GTK 3.10 + + * gst-gtk.c: Removed (now) obsolete scrolled_window_get_hscrollbar_visible() + and scrolled_window_get_vscrollbar_visible() + * placer.c: Updated to GTK 3.0 API + * structs.awk: Removed GtkObject and GdkDrawable,- they're gone in + GTK 3.0 + * funcs.awk: Makde gdk_window_*() functions to belong to GdkWindow + and not to GdkDrawable (which is gone) + * MoreFuncs.st: Removed extensions for GtkObject (it's gone) and + callouts in GtkScrolledWindow (GTK 3.0 provides accessors) + * GtkImpl.st: Removed extensios to GdkRectangle which is an alias to + cairo_rectangle_int_t in GTK 3.0. Moved extensions of (now gone) + GdkDrawable to GdkWindow + +2015-04-15 Jan Vrany <[hidden email]> + Updated to GTK 2.20+ * gst-gtk.c: Removed a number of accessors as newer GTK diff --git a/packages/gtk/GtkImpl.st b/packages/gtk/GtkImpl.st index 4dfc385..97ee541 100644 --- a/packages/gtk/GtkImpl.st +++ b/packages/gtk/GtkImpl.st @@ -16,7 +16,7 @@ GtkAlignment class extend [ ] -GdkDrawable extend [ +GdkWindow extend [ withContextDo: aBlock [ "Execute aBlock passing a valid Cairo context for the @@ -128,102 +128,6 @@ GtkRequisition extend [ ] - - -GdkRectangle class extend [ - - fromRectangle: rect [ - <category: 'instance creation'> - | ba | - ba := (CShortType arrayType: 4) new. - ba at: 0 put: rect left. - ba at: 1 put: rect top. - ba at: 2 put: rect width. - ba at: 3 put: rect height. - ^(ba castTo: self type) - addToBeFinalized; - yourself - ] - -] - - - -GdkRectangle extend [ - - left [ - <category: 'accessing'> - | ba | - ba := self castTo: (CShortType arrayType: 4). - ^ba at: 0 - ] - - top [ - <category: 'accessing'> - | ba | - ba := self castTo: (CShortType arrayType: 4). - ^ba at: 1 - ] - - right [ - <category: 'accessing'> - | ba | - ba := self castTo: (CShortType arrayType: 4). - ^(ba at: 0) + (ba at: 2) - ] - - bottom [ - <category: 'accessing'> - | ba | - ba := self castTo: (CShortType arrayType: 4). - ^(ba at: 1) + (ba at: 3) - ] - - width [ - <category: 'accessing'> - | ba | - ba := self castTo: (CShortType arrayType: 4). - ^ba at: 2 - ] - - height [ - <category: 'accessing'> - | ba | - ba := self castTo: (CShortType arrayType: 4). - ^ba at: 3 - ] - - origin [ - <category: 'accessing'> - | ba | - ba := self castTo: (CShortType arrayType: 4). - ^(ba at: 0) @ (ba at: 1) - ] - - extent [ - <category: 'accessing'> - | ba | - ba := self castTo: (CShortType arrayType: 4). - ^(ba at: 2) @ (ba at: 3) - ] - - corner [ - <category: 'accessing'> - | ba | - ba := self castTo: (CShortType arrayType: 4). - ^((ba at: 0) + (ba at: 2)) @ ((ba at: 1) + (ba at: 3)) - ] - - asRectangle [ - <category: 'conversion'> - | ba | - ba := self castTo: (CShortType arrayType: 4). - ^(ba at: 0) @ (ba at: 1) extent: (ba at: 2) @ (ba at: 3) - ] - -] - - GtkTreeIter class extend [ diff --git a/packages/gtk/MoreFuncs.st b/packages/gtk/MoreFuncs.st index a4a0585..694ce58 100644 --- a/packages/gtk/MoreFuncs.st +++ b/packages/gtk/MoreFuncs.st @@ -27,55 +27,7 @@ GtkAccelGroup extend [ ] ] - -"These have a weird name in C." - -GtkObject extend [ - signalEmit: signal args: argsArray [ - <category: 'C call-outs'> - <cCall: 'gtk_signal_emit' returning: #void - args: #(#self #int #variadic)> - - ] - - signalEmitByName: signal args: argsArray [ - <category: 'C call-outs'> - <cCall: 'gtk_signal_emit_by_name' returning: #void - args: #(#self #string #variadic)> - - ] - - signalNEmissions: signal [ - <category: 'C call-outs'> - <cCall: 'gtk_signal_n_emissions' returning: #int - args: #(#self #int)> - - ] - - signalNEmissionsByName: signal [ - <category: 'C call-outs'> - <cCall: 'gtk_signal_n_emissions_by_name' returning: #int - args: #(#self #string)> - - ] - - signalEmitStop: signal [ - <category: 'C call-outs'> - <cCall: 'gtk_signal_emit_stop' returning: #void - args: #(#self #int)> - - ] - - signalEmitStopByName: signal [ - <category: 'C call-outs'> - <cCall: 'gtk_signal_emit_stop_by_name' returning: #void - args: #(#self #string)> - - ] - -] - -GTK.GdkDrawable extend [ +GTK.GdkWindow extend [ cairoCreate [ <category: 'C call-outs'> @@ -196,15 +148,12 @@ GtkDialog extend [ GtkScrolledWindow extend [ getHscrollbarVisible [ - <category: 'C call-outs'> - <cCall: 'gstGtkGetHscrollbarVisible' returning: #boolean args: #(#self )> + self getHscrollbar getVisible ] getVscrollbarVisible [ - <category: 'C call-outs'> - <cCall: 'gstGtkGetVscrollbarVisible' returning: #boolean args: #(#self )> - + self getHscrollbar getVisible ] ] diff --git a/packages/gtk/funcs.awk b/packages/gtk/funcs.awk index 4157ff0..6513b19 100644 --- a/packages/gtk/funcs.awk +++ b/packages/gtk/funcs.awk @@ -117,9 +117,9 @@ BEGIN { # Not really exact, this belongs in GtkFileChooserWidget too. # We need a way to do interfaces. prefix_class["gtk_file_chooser_"] = "GtkFileChooserDialog" - prefix_class["gdk_window_"] = "GdkDrawable" + #prefix_class["gdk_window_"] = "GdkDrawable" self_class["gtk_file_chooser_"] = "GtkFileChooserDialog" - self_class["gdk_window_"] = "GdkWindow" + #self_class["gdk_window_"] = "GdkWindow" } # Pick the correct case for the class (e.g. CList vs. Clist) diff --git a/packages/gtk/gst-gtk.c b/packages/gtk/gst-gtk.c index 9a29c21..30176df 100644 --- a/packages/gtk/gst-gtk.c +++ b/packages/gtk/gst-gtk.c @@ -231,18 +231,6 @@ widget_unset_flags (GtkWidget *widget, int flags) GTK_WIDGET_UNSET_FLAGS (widget, flags); } -static int -scrolled_window_get_hscrollbar_visible (GtkScrolledWindow *swnd) -{ - return (GTK_SCROLLED_WINDOW(swnd)->hscrollbar_visible); -} - -static int -scrolled_window_get_vscrollbar_visible (GtkScrolledWindow *swnd) -{ - return (GTK_SCROLLED_WINDOW(swnd)->vscrollbar_visible); -} - /* Initialization. */ static int initialized = 0; @@ -272,8 +260,6 @@ gst_initModule (proxy) _gtk_vm_proxy->defineCFunc ("gstGtkGetFlags", widget_get_flags); _gtk_vm_proxy->defineCFunc ("gstGtkSetFlags", widget_set_flags); _gtk_vm_proxy->defineCFunc ("gstGtkUnsetFlags", widget_unset_flags); - _gtk_vm_proxy->defineCFunc ("gstGtkGetHscrollbarVisible", scrolled_window_get_hscrollbar_visible); - _gtk_vm_proxy->defineCFunc ("gstGtkGetVscrollbarVisible", scrolled_window_get_vscrollbar_visible); _gtk_vm_proxy->defineCFunc ("gstGtkTreeModelGetOOP", tree_model_get_oop); _gtk_vm_proxy->defineCFunc ("gstGtkListStoreSetOOP", list_store_set_oop); _gtk_vm_proxy->defineCFunc ("gstGtkTreeStoreSetOOP", tree_store_set_oop); diff --git a/packages/gtk/placer.c b/packages/gtk/placer.c index d019ef1..ddb927a 100644 --- a/packages/gtk/placer.c +++ b/packages/gtk/placer.c @@ -70,6 +70,12 @@ static void gtk_placer_init (GtkPlacer *placer); static void gtk_placer_realize (GtkWidget *widget); static void gtk_placer_size_request (GtkWidget *widget, GtkRequisition *requisition); +static void gtk_placer_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width); +static void gtk_placer_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height); static void gtk_placer_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_placer_add (GtkContainer *container, @@ -135,7 +141,8 @@ gtk_placer_class_init (GtkPlacerClass *class) parent_class = g_type_class_peek_parent (class); widget_class->realize = gtk_placer_realize; - widget_class->size_request = gtk_placer_size_request; + widget_class->get_preferred_width = gtk_placer_get_preferred_width; + widget_class->get_preferred_height = gtk_placer_get_preferred_height; widget_class->size_allocate = gtk_placer_size_allocate; container_class->add = gtk_placer_add; @@ -549,13 +556,12 @@ gtk_placer_realize (GtkWidget *widget) attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); - attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK; - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; + attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; - window = gdk_window_new (gtk_widget_get_parent_window (widget), + window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gtk_widget_set_window(widget, window); @@ -629,6 +635,26 @@ gtk_placer_size_request (GtkWidget *widget, } static void +gtk_placer_get_preferred_width (GtkWidget *widget, + gint *minimal_width, + gint *natural_width) +{ + GtkRequisition requisition; + gtk_placer_size_request (widget, &requisition); + *minimal_width = *natural_width = requisition.width; +} + +static void +gtk_placer_get_preferred_height (GtkWidget *widget, + gint *minimal_height, + gint *natural_height) +{ + GtkRequisition requisition; + gtk_pkacer_size_request (widget, &requisition); + *minimal_height = *natural_height = requisition.height; +} + +static void gtk_placer_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { diff --git a/packages/gtk/structs.awk b/packages/gtk/structs.awk index 6818924..67d50a3 100644 --- a/packages/gtk/structs.awk +++ b/packages/gtk/structs.awk @@ -36,16 +36,19 @@ BEGIN { # These are implemented strangely... classNames["GValue"] = "" - classNames["GdkAtom"] = "" - classNames["GtkObject"] = "" + classNames["GdkAtom"] = "" classNames["GtkEditable"] = "" # GtkEditable is a dummy class, so we must set inheritance manually known_parent["GtkEntry"] = "GtkEditable" known_parent["GtkEditable"] = "GtkWidget" - known_parent["GtkObject"] = "GLib.GObject" - known_parent["GdkWindowObject"] = "GdkDrawable" + known_parent["GtkWidget"] = "GLib.GObject" + known_parent["GtkAdjustment"] = "GLib.GObject" + known_parent["GtkCellRenderer"] = "GLib.GObject" + known_parent["GtkCellArea"] = "GLib.GObject" + known_parent["GtkTreeViewColumn"] = "GLib.GObject" + # A couple of things that we need from GLib known_parent["GOptionGroup"] = "CObject" known_parent["GDate"] = "CObject" -- 2.1.4 _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |