antiright-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Antiright-devel] antiright/gtkshell options.c swallow.c swallow.h


From: Jeffrey Bedard
Subject: [Antiright-devel] antiright/gtkshell options.c swallow.c swallow.h
Date: Mon, 26 Nov 2007 22:40:46 +0000

CVSROOT:        /sources/antiright
Module name:    antiright
Changes by:     Jeffrey Bedard <jefbed> 07/11/26 22:40:46

Modified files:
        gtkshell       : options.c swallow.c swallow.h 

Log message:
        Make the swallow code actually work.  Use a GtkSocket instead of the
        non-working hack previously used.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/options.c?cvsroot=antiright&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/swallow.c?cvsroot=antiright&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/antiright/gtkshell/swallow.h?cvsroot=antiright&r1=1.1&r2=1.2

Patches:
Index: options.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/options.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- options.c   13 Aug 2007 11:08:28 -0000      1.31
+++ options.c   26 Nov 2007 22:40:46 -0000      1.32
@@ -63,7 +63,7 @@
        /* Shortcut for specification of arguments.  */
 #define GGEA gsh_guidl_env->args
 #ifdef DEBUG
-       print_arguments(GGEA->argc, GGEA->argv);
+       print_arguments((const gint)GGEA->argc, (const gchar **)GGEA->argv);
 #endif /* DEBUG */
        $(gsh, parse, GGEA->argc, (const gchar **)GGEA->argv);
        $(gsh_guidl_env, delete);
@@ -111,10 +111,12 @@
                break;
        case 't': /* test area.  */
                {
-                       GtkWidget * parent;
-                       parent=gtk_event_box_new();
-                       gsh_swallow_app(parent, "internal");
-                       $(gsh, manage, parent);
+                       GtkWidget * swallower;
+                       swallower=gtk_socket_new();
+                       $(gsh, manage, swallower);
+                       gtk_widget_show_all(gsh->widgets.window);
+                       GSH_COUNT(argc, counter);
+                       gsh_swallow_app(swallower, argv[*counter]);
                }
                break;
        default:

Index: swallow.c
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/swallow.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- swallow.c   13 Aug 2007 11:08:28 -0000      1.1
+++ swallow.c   26 Nov 2007 22:40:46 -0000      1.2
@@ -29,6 +29,8 @@
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 
+#if 0
+
 static gboolean 
 swallow(char* wantedWindow, Display* display, Screen* screen, Window hunger, 
        unsigned int* width, unsigned int* height)
@@ -170,26 +172,34 @@
     return ret;
 }
 
+#endif /* 0 */
+
+struct
+SwallowData
+{
+       GtkSocket * swallower;
+       GdkNativeWindow window_id;
+};
+
+static void
+swallow_app(gpointer client_data, gpointer user_data)
+{
+       struct SwallowData * swallow_manager = client_data;
+
+       gtk_socket_steal(swallow_manager->swallower, 
+               swallow_manager->window_id);
+//     g_free(swallow_manager);
+}
+
 void
-gsh_swallow_app(GtkWidget * target, gchar * source_name)
+gsh_swallow_app(GtkWidget * swallower, const gchar * source_name)
 {
-       GdkWindow * window = target->window;
+       struct SwallowData * swallow_manager 
+               = g_malloc(sizeof(struct SwallowData));
+
+       swallow_manager->swallower=GTK_SOCKET(swallower);
+       swallow_manager->window_id=atoi(source_name);
 
-       swallow(source_name, 
-               GDK_WINDOW_XDISPLAY(window),
-               GDK_SCREEN_XSCREEN(gtk_widget_get_screen(target)),
-               GDK_WINDOW_XWINDOW(window), 
-               (unsigned int *)&(target->requisition.width), 
-               (unsigned int *)&(target->requisition.height));
-       gtk_widget_set_size_request(target,
-               target->requisition.width,
-               target->requisition.height);
+       (void) g_timeout_add(1000, swallow_app, swallow_manager);
 }
 
-/* example
-    if(swallow(ap->applet_name,
-            GDK_DISPLAY_XDISPLAY(gdkdisplay),
-            GDK_SCREEN_XSCREEN(gdkscreen),
-            GDK_WINDOW_XWINDOW (GTK_WIDGET (ap->parentWidget)->window),
-               &ap->width, &ap->height))
-*/

Index: swallow.h
===================================================================
RCS file: /sources/antiright/antiright/gtkshell/swallow.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- swallow.h   13 Aug 2007 11:08:28 -0000      1.1
+++ swallow.h   26 Nov 2007 22:40:46 -0000      1.2
@@ -24,7 +24,7 @@
 #define GSH_SWALLOW_H
 
 void
-gsh_swallow_app(GtkWidget * target, gchar * source_name);
+gsh_swallow_app(GtkWidget * target, const gchar * source_name);
 
 #endif /* GSH_SWALLOW_H */
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]