diff --git a/ChangeLog b/ChangeLog index 21f834bd0..bbc793f24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-08-13 Christian Hoff + + * gtk/Widget.custom: Set the activate/set_scroll_adjustments signal IDs + from managed code. Use the gtk_widget_get_window accessor. + * gtk/glue/widget.c: Remove the corresponding glue functions. + 2009-08-13 Christian Hoff * generator/IGeneratable.cs: Remove MarshalReturnType, ToNativeReturnType, diff --git a/gtk/Widget.custom b/gtk/Widget.custom index 27292bd91..12fd8b5e0 100644 --- a/gtk/Widget.custom +++ b/gtk/Widget.custom @@ -42,19 +42,11 @@ public Gdk.Rectangle Allocation { set { SizeAllocate (value); } } -[DllImport ("gtksharpglue-2")] -static extern IntPtr gtksharp_gtk_widget_get_window (IntPtr widget); [DllImport ("gtksharpglue-2")] static extern void gtksharp_gtk_widget_set_window (IntPtr widget, IntPtr window); public Gdk.Window GdkWindow { get { - IntPtr raw_ret = gtksharp_gtk_widget_get_window (Handle); - - if (raw_ret != (IntPtr) 0){ - Gdk.Window ret = (Gdk.Window) GLib.Object.GetObject(raw_ret, false); - return ret; - } - return null; + return this.Window; } set { Gdk.Window window = value as Gdk.Window; @@ -242,16 +234,14 @@ static void SetScrollAdjustmentsMarshal_cb (IntPtr closure, IntPtr return_val, u static ClosureMarshal SetScrollAdjustmentsMarshalCallback; -[DllImport("gtksharpglue-2")] -static extern void gtksharp_widget_class_set_set_scroll_adjustments_signal (IntPtr class_struct, uint signal_id); - static void ConnectSetScrollAdjustments (GLib.GType gtype) { if (SetScrollAdjustmentsMarshalCallback == null) SetScrollAdjustmentsMarshalCallback = new ClosureMarshal (SetScrollAdjustmentsMarshal_cb); - uint signal_id = RegisterSignal ("set_scroll_adjustments", gtype, GLib.Signal.Flags.RunLast, GLib.GType.None, new GLib.GType [] {Adjustment.GType, Adjustment.GType}, SetScrollAdjustmentsMarshalCallback); - gtksharp_widget_class_set_set_scroll_adjustments_signal (gtype.GetClassPtr (), signal_id); + GtkWidgetClass klass = GetClassStruct (gtype, false); + klass.SetScrollAdjustmentsSignal = RegisterSignal ("set_scroll_adjustments", gtype, GLib.Signal.Flags.RunLast, GLib.GType.None, new GLib.GType [] {Adjustment.GType, Adjustment.GType}, SetScrollAdjustmentsMarshalCallback); + OverrideClassStruct (gtype, klass); } [GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectSetScrollAdjustments")] @@ -277,16 +267,14 @@ static void ActivateMarshal_cb (IntPtr raw_closure, IntPtr return_val, uint n_pa static ClosureMarshal ActivateMarshalCallback; -[DllImport("gtksharpglue-2")] -static extern void gtksharp_widget_class_set_activate_signal (IntPtr class_struct, uint signal_id); - static void ConnectActivate (GLib.GType gtype) { if (ActivateMarshalCallback == null) ActivateMarshalCallback = new ClosureMarshal (ActivateMarshal_cb); - uint signal_id = RegisterSignal ("activate_signal", gtype, GLib.Signal.Flags.RunLast, GLib.GType.None, new GLib.GType [0], ActivateMarshalCallback); - gtksharp_widget_class_set_activate_signal (gtype.GetClassPtr (), signal_id); + GtkWidgetClass klass = GetClassStruct (gtype, false); + klass.ActivateSignal = RegisterSignal ("activate_signal", gtype, GLib.Signal.Flags.RunLast, GLib.GType.None, new GLib.GType [0], ActivateMarshalCallback); + OverrideClassStruct (gtype, klass); } [GLib.DefaultSignalHandler (Type=typeof (Gtk.Widget), ConnectionMethod="ConnectActivate")] @@ -387,9 +375,9 @@ static void ClassInit (GLib.GType gtype, Type t) arg.arg_type = GLib.GType.Long.Val; int binding_invoker_idx = binding_invokers.Add (new BindingInvoker (mi, attr.Parms)); #if WIN64LONGS - arg.data.long_data = binding_invoker_idx; + arg.data.long_data = binding_invoker_idx; #else - arg.data.long_data = new IntPtr (binding_invoker_idx); + arg.data.long_data = new IntPtr (binding_invoker_idx); #endif GLib.SList binding_args = new GLib.SList (new object[] {arg}, typeof (GtkBindingArg), false, false); diff --git a/gtk/glue/widget.c b/gtk/glue/widget.c index b490da57c..19066400c 100644 --- a/gtk/glue/widget.c +++ b/gtk/glue/widget.c @@ -26,16 +26,10 @@ /* Forward declarations */ GdkRectangle *gtksharp_gtk_widget_get_allocation (GtkWidget *widget); -GdkWindow *gtksharp_gtk_widget_get_window (GtkWidget *widget); void gtksharp_gtk_widget_set_window (GtkWidget *widget, GdkWindow *window); int gtksharp_gtk_widget_get_state (GtkWidget *widget); int gtksharp_gtk_widget_get_flags (GtkWidget *widget); void gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags); -int gtksharp_gtk_widget_style_get_int (GtkWidget *widget, const char *name); -void gtksharp_widget_class_set_set_scroll_adjustments_signal (GtkWidgetClass *klass, guint signal_id); -void gtksharp_widget_class_set_activate_signal (GtkWidgetClass *klass, guint signal_id); -int gtksharp_gtk_widget_get_flags (GtkWidget *widget); -void gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags); /* */ GdkRectangle* @@ -44,12 +38,6 @@ gtksharp_gtk_widget_get_allocation (GtkWidget *widget) return &widget->allocation; } -GdkWindow * -gtksharp_gtk_widget_get_window (GtkWidget *widget) -{ - return widget->window; -} - void gtksharp_gtk_widget_set_window (GtkWidget *widget, GdkWindow *window) { @@ -76,15 +64,3 @@ gtksharp_gtk_widget_set_flags (GtkWidget *widget, int flags) GTK_OBJECT(widget)->flags = flags; } -void -gtksharp_widget_class_set_set_scroll_adjustments_signal (GtkWidgetClass *klass, guint signal_id) -{ - klass->set_scroll_adjustments_signal = signal_id; -} - -void -gtksharp_widget_class_set_activate_signal (GtkWidgetClass *klass, guint signal_id) -{ - klass->activate_signal = signal_id; -} -