Bug 477936: First argument of g_signal_XX functions doesn't need the G_OBJECT cast, r=mfinkle
authorHiroyuki Ikezoe <ikezoe@clear-code.com>
Thu, 26 Mar 2009 00:48:30 -0500
changeset 117 0567bf985e06bf238c02d509e186fba5da1d2746
parent 116 a6038143acd010f52f677cd7615117cc79ee0be9
child 118 c335c76103d5964be0a9861e52e0660464a46b3f
push id35
push usermfinkle@mozilla.com
push dateThu, 26 Mar 2009 05:49:00 +0000
reviewersmfinkle
bugs477936
Bug 477936: First argument of g_signal_XX functions doesn't need the G_OBJECT cast, r=mfinkle
gtk/win32/moz-web-view.cpp
--- a/gtk/win32/moz-web-view.cpp
+++ b/gtk/win32/moz-web-view.cpp
@@ -109,17 +109,17 @@ moz_web_view_viewable_init (MozViewableI
 G_DEFINE_TYPE_WITH_CODE (MozWebView, moz_web_view, GTK_TYPE_BIN,
                          G_IMPLEMENT_INTERFACE (MOZ_TYPE_VIEWABLE,
                                                 moz_web_view_viewable_init))
 
 static void
 update_property (MozWebView  *view, gint prop_id, const gchar *new_value)
 {
     MozWebViewPriv *priv = view->priv;
-    const gchar *name = NULL; 
+    const gchar *name = NULL;
     gchar **ptr;
 
     switch (prop_id) {
         case PROP_REQUESTED_URI: ptr = &(priv->requested_uri); name = "requested-uri";  break;
         case PROP_TITLE:         ptr = &(priv->title);         name = "title";  break;
         case PROP_STATUS:        ptr = &(priv->status);        name = "status";  break;
         case PROP_LOCATION:      ptr = &(priv->location);      name = "location";  break;
         default:
@@ -178,17 +178,17 @@ public:
 static void
 moz_web_view_class_init(MozWebViewClass *klass)
 {
     GObjectClass     *object_klass = G_OBJECT_CLASS(klass);
     GtkWidgetClass   *widget_klass = GTK_WIDGET_CLASS(klass);
 
     object_klass->finalize      = moz_web_view_finalize;
     object_klass->get_property  = moz_web_view_get_property;
-    
+
     widget_klass->realize           = moz_web_view_realize;
     widget_klass->unrealize         = moz_web_view_unrealize;
     widget_klass->hierarchy_changed = moz_web_view_hierarchy_changed;
     widget_klass->size_allocate     = moz_web_view_size_allocate;
     widget_klass->map               = moz_web_view_map;
     widget_klass->unmap             = moz_web_view_unmap;
 
     signals[TITLE_CHANGED] = g_signal_lookup ("title-changed", MOZ_TYPE_WEB_VIEW);
@@ -205,22 +205,22 @@ moz_web_view_class_init(MozWebViewClass 
 
     g_type_class_add_private(object_klass, sizeof(MozWebViewPriv));
 }
 
 static void
 moz_web_view_init(MozWebView *view)
 {
     MozWebViewPriv *priv;
-    
+
     view->priv = priv = GET_PRIV(view);
-    
+
     GTK_WIDGET_SET_FLAGS(view, GTK_NO_WINDOW);
     GTK_WIDGET_SET_FLAGS(view, GTK_CAN_FOCUS);
-    
+
     priv->app = new MozApp();
     priv->view = new MozView();
     priv->listener = new ViewListener(view);
     priv->view->SetListener(priv->listener);
 }
 
 /*******************************************************************
  *                           GObjectClass                          *
@@ -240,22 +240,22 @@ moz_web_view_finalize(GObject *object)
 
     delete view->priv->app;
     delete view->priv->view;
     delete view->priv->listener;
 
     (G_OBJECT_CLASS(moz_web_view_parent_class)->finalize)(object);
 }
 
-static void 
+static void
 moz_web_view_get_property (GObject     *object,
                            guint        prop_id,
                            GValue      *value,
                            GParamSpec  *pspec)
-{ 
+{
     MozWebViewPriv *priv = MOZ_WEB_VIEW (object)->priv;
 
     switch (prop_id) {
         case PROP_REQUESTED_URI:
             g_value_set_string (value, priv->requested_uri);
         break;
         case PROP_TITLE:
             g_value_set_string (value, priv->title);
@@ -279,185 +279,185 @@ moz_web_view_get_property (GObject     *
 static void
 moz_web_view_realize(GtkWidget *widget)
 {
     MozWebViewPriv *priv = GET_PRIV(widget);
     GdkWindowAttr attributes;
     gint attributes_mask;
 
     GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
-    
+
     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.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) |  //| GDK_ALL_EVENTS_MASK;
 	GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK |
 	GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK |
 	GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK;
-    
+
     attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-    
+
     widget->window = gtk_widget_get_parent_window(widget);
     g_object_ref(widget->window);
-    
+
     priv->native_window = create_native_window(widget);
-    
+
     priv->view->CreateBrowser(priv->native_window, 0, 0,
 			      widget->allocation.width, widget->allocation.height);
-    
+
     widget->style = gtk_style_attach(widget->style, widget->window);
     gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL);
-    
+
     if (priv->requested_uri)
         moz_web_view_load_uri(MOZ_WEB_VIEW(widget), priv->requested_uri);
 }
 
 static void
 moz_web_view_unrealize(GtkWidget *widget)
 {
     MozWebViewPriv *priv = GET_PRIV(widget);
 
     RemoveProp(priv->native_window, "moz-view-widget");
 
     if (!DestroyWindow(priv->native_window))
 	g_warning("Problems destoying native view window");
-        
+
     priv->native_window = NULL;
-    
+
     GTK_WIDGET_CLASS(moz_web_view_parent_class)->unrealize(widget);
 }
 
 static void
 moz_web_view_hierarchy_changed(GtkWidget         *widget,
                                GtkWidget         *previous_toplevel)
 {
     GtkWidget *toplevel = gtk_widget_get_toplevel(widget);
 
     /* At least toplevel or previous_toplevel should exist */
     g_assert(toplevel || previous_toplevel);
 
     DBG(g_print("Hierarchy changed ! toplevel %p previous_toplevel %p\n", toplevel, previous_toplevel));
-    
+
     if (GTK_IS_WINDOW(toplevel)) {
-        g_signal_connect(G_OBJECT(toplevel), "configure-event",
+        g_signal_connect(toplevel, "configure-event",
                          G_CALLBACK(handle_toplevel_configure), widget);
     }
-    
+
     if (GTK_IS_WINDOW(previous_toplevel)) {
-        g_signal_handlers_disconnect_by_func(G_OBJECT(previous_toplevel), 
+        g_signal_handlers_disconnect_by_func(previous_toplevel,
                                              (gpointer)handle_toplevel_configure,
                                              widget);
     }
 }
 
 static void
 moz_web_view_size_allocate(GtkWidget     *widget,
                            GtkAllocation *allocation)
 {
     MozWebViewPriv *priv = GET_PRIV(widget);
-    
+
     g_return_if_fail(allocation != NULL);
-    
+
     widget->allocation = *allocation;
-    
+
     if (GTK_WIDGET_REALIZED(widget)) {
         gint x, y;
-	
+
         gdk_window_get_position(widget->window, &x, &y);
         x += allocation->x;
         y += allocation->y;
 
         SetWindowPos(priv->native_window, NULL, x, y,
                      allocation->width, allocation->height,
                      SWP_NOACTIVATE | SWP_NOZORDER);
 
         priv->view->SetPositionAndSize(0, 0, allocation->width, allocation->height);
     }
 }
 
 static void
 moz_web_view_map(GtkWidget *widget)
 {
     MozWebViewPriv *priv = GET_PRIV(widget);
-    
+
     /* This will ensure a realized widget */
     GTK_WIDGET_CLASS(moz_web_view_parent_class)->map(widget);
-    
+
     ShowWindow(priv->native_window, SW_SHOW);
 }
 
 static void
 moz_web_view_unmap(GtkWidget *widget)
 {
     MozWebViewPriv *priv = GET_PRIV(widget);
-    
+
     GTK_WIDGET_CLASS(moz_web_view_parent_class)->unmap(widget);
-    	
+
     ShowWindow(priv->native_window, SW_HIDE);
 }
 
 /* We handle configure events on the toplevel in order to
  * reposition our window when the toplevel moves.
  */
-static gboolean 
+static gboolean
 handle_toplevel_configure(GtkWidget         *toplevel,
                           GdkEventConfigure *event,
                           GtkWidget         *widget)
 {
     MozWebViewPriv *priv;
     gint x, y;
 
     priv = GET_PRIV(widget);
 
-    DBG(g_print("Configure event !\n"));    
+    DBG(g_print("Configure event !\n"));
 
     gdk_window_get_position(widget->window, &x, &y);
     x += widget->allocation.x;
     y += widget->allocation.y;
 
     SetWindowPos(priv->native_window, NULL, x, y,
                  widget->allocation.width, widget->allocation.height,
                  SWP_NOACTIVATE | SWP_NOZORDER);
 
     return FALSE;
 }
 
 /* Handle the window procedure by the window class directly
  * in order to call SetFocus() at the appropriate times.
  */
-static LRESULT 
+static LRESULT
 window_procedure(HWND   hwnd,
 		  UINT   message,
 		  WPARAM wparam,
 		  LPARAM lparam)
 {
     GtkWidget *widget;
     MozWebViewPriv *priv;
-	
+
     widget = (GtkWidget *)GetProp(hwnd, "moz-view-widget");
 
     DBG(g_print("Procedure called ! widget %p\n", widget));
 
 
     /* The first few messages are fired inside CreateWindowEx(), so we
      * havent set the widget data yet.
      */
     if (widget)
         priv = GET_PRIV(widget);
     else
         return DefWindowProcW(hwnd, message, wparam, lparam);
 
     switch (message) {
         case WM_INITDIALOG:
-        case WM_INITMENU: 
+        case WM_INITMENU:
         case WM_DESTROY:
             return TRUE;
         case WM_SYSCOMMAND:
             if (wparam == SC_CLOSE) {
                 DBG(g_print("Close message..\n"));
                 return TRUE;
             }
         break;
@@ -478,25 +478,25 @@ window_procedure(HWND   hwnd,
     return DefWindowProcW(hwnd, message, wparam, lparam);
 }
 
 /*****************************************************
  * Hack ahead !!!
  *
  * Problems here have to do with focus handling, i.e.
  * sharing and passing keyboard focus back and forth from
- * the gecko window to the rest of the app. The gecko 
+ * the gecko window to the rest of the app. The gecko
  * wants us to turn focus on and off when we receive the
- * WM_ACTIVATE message for our window; Gtk+ does not give 
- * us an opportunity to act on this message (TODO: patch 
+ * WM_ACTIVATE message for our window; Gtk+ does not give
+ * us an opportunity to act on this message (TODO: patch
  * gtk+ to do so and run tests).
  *
  * Also tried to turn on and off focus near when activate
  * messages come (i.e. focus in/out of the toplevel window)
- * with no luck (works to get started, but the gecko 
+ * with no luck (works to get started, but the gecko
  * will never relinquish focus afterwords).
  *
  * The current hack/workaround:
  *   We are using a native toplevel window, that we reposition
  * to follow the widget hierarchy on toplevel configure events,
  * this way we handle the WM_ACTIVATE messages and focus handleing
  * works, on the other hand accelerators keys tied into the higher
  * level window wont trigger when the gecko has focus (is that
@@ -506,43 +506,43 @@ window_procedure(HWND   hwnd,
 static HWND
 create_native_window(GtkWidget *widget)
 {
     static ATOM klass = 0;
     HWND window_handle, parent_handle;
     DWORD dwStyle, dwExStyle;
 
     if (!klass) {
-         static WNDCLASSEXW wcl; 
-	
+         static WNDCLASSEXW wcl;
+
          wcl.cbSize = sizeof(WNDCLASSEX);
          wcl.style = 0;
 
         /* DON'T set CS_<H,V>REDRAW. It causes total redraw
          * on WM_SIZE and WM_MOVE. Flicker, Performance!
          */
          wcl.lpfnWndProc = (WNDPROC)window_procedure;
          wcl.cbClsExtra = 0;
          wcl.cbWndExtra = 0;
          wcl.hInstance = GetModuleHandle(NULL);
          wcl.hIcon = 0;
          wcl.hIconSm = 0;
          wcl.lpszMenuName = NULL;
          wcl.hIcon = NULL;
          wcl.hIconSm = NULL;
          wcl.hbrBackground = NULL;
-         wcl.hCursor = LoadCursor(NULL, IDC_ARROW); 
+         wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
          wcl.lpszClassName = L"MozWindow";
 
          klass = RegisterClassExW(&wcl);
     }
 
-    dwExStyle = WS_EX_TOOLWINDOW; // for popup windows 
+    dwExStyle = WS_EX_TOOLWINDOW; // for popup windows
     dwStyle = WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; // popup window
-    
+
     parent_handle = (HWND)GDK_WINDOW_HWND(gtk_widget_get_parent_window(widget));
     window_handle = CreateWindowExW(dwExStyle,
                                     MAKEINTRESOURCEW(klass),
                                     L"",
                                     dwStyle,
                                     0, 0, 1, 1,
                                     parent_handle,
                                     NULL,