gtk2/gtk/gtksocket.c

1477 lines
39 KiB
C
Raw Normal View History

/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* By Owen Taylor <otaylor@gtk.org> 98/4/4 */
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "gdk/gdkkeysyms.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkwindow.h"
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
#include "gtkplug.h"
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
#include "gtkprivate.h"
#include "gtksignal.h"
#include "gtksocket.h"
#include "gtkdnd.h"
#include "x11/gdkx.h"
#include "xembed.h"
This might seem like a large patch, but it isn't that bad, and nothing should break on Unix/X11. Win32 merge and general portability stuff: * acconfig.h,configure.in: Check for <sys/time.h>. * gdk/win32: New directory (actually, been there for a while). * gtk/fnmatch.c: Include <glib.h> for G_DIR_SEPARATOR, WIN32 and NATIVE_WIN32, and use these. Always case fold on Win32. No backslashed escapes on native Win32. * gtk/{gtk.def,makefile.msc}: New files. * gtk/Makefile.am: Add above new files. * gtk/{gtkaccelgroup,gtkbindings}.c: Include <string.h> instead of <strings.h>. * gtk/{gtkcalendar,gtkitemfactory,gtkpreview,gtkrc}.c: Include config.h. Protect inclusion of <sys/param.h>, <sys/time.h>, and <unistd.h> appropriately. * gtk/gtkdnd.c: Merge in Win32 version (which doesn't do much). Use ABS() (from <glib.h>) instead of abs(). * gtk/gtkfilesel.c: Moved Win32-specific includes after inclusion of gtk (and thus glib) headers, so that WIN32 will be defined. With MS C, include <direct.h> for mkdir prototype. * gtk/gtkitemfactory.c (gtk_item_factory_callback_marshal): Add some casts, needed by MS C. * gtk/{gtklayout,gtkplug}.c: Merge in Win32 version (which isn't implemented). * gtk/gtkmain.c: Include gdk/gdkx.h for GDK_WINDOWING. Include <X11/Xlocale.h> only on X11 platform, otherwise <locale.h>. Use G_SEARCHPATH_SEPARATOR_S and g_module_build_path. * gtk/gtkmain.h: Mark variables for export/import on Win32. * gtk/gtkrange.c (gtk_range_motion_notify): Set mods also in case the event is not a hint, or its window is not the slider. Needed on Win32, at least. * gtk/gtkrc.c: Include config.h and gdk/gdkx.h. Use <locale.h> unless on X11. Skip \r chars, too. Use G_DIR_SEPARATOR and G_SEARCHPATH_SEPARATOR(_S). Use g_path_is_absolute. On Win32, use a subdirectory of the Windows directory as gtk system configuration directory. * gtk/gtkselection.c: No chunks on Win32. * gtk/gtksocket.c: Not implemented on Win32. * gtk/gtkthemes.c (gtk_theme_engine_get): Use g_module_build_path. * gtk/makeenums.h: Include gdkprivate.h after gdk.h. * gtk/testrgb.c: Use dynamically allocated buffer. Use GTimers.
1999-03-15 00:03:37 +00:00
/* Forward declararations */
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
static void gtk_socket_class_init (GtkSocketClass *klass);
static void gtk_socket_init (GtkSocket *socket);
static void gtk_socket_finalize (GObject *object);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
static void gtk_socket_realize (GtkWidget *widget);
static void gtk_socket_unrealize (GtkWidget *widget);
static void gtk_socket_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_socket_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_socket_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
static void gtk_socket_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static gboolean gtk_socket_key_press_event (GtkWidget *widget,
GdkEventKey *event);
static gboolean gtk_socket_focus_in_event (GtkWidget *widget,
GdkEventFocus *event);
static void gtk_socket_claim_focus (GtkSocket *socket);
static gboolean gtk_socket_focus_out_event (GtkWidget *widget,
GdkEventFocus *event);
static void gtk_socket_send_configure_event (GtkSocket *socket);
static gboolean gtk_socket_focus (GtkWidget *widget,
GtkDirectionType direction);
static void gtk_socket_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_socket_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_socket_add_window (GtkSocket *socket,
GdkNativeWindow xid,
gboolean need_reparent);
static GdkFilterReturn gtk_socket_filter_func (GdkXEvent *gdk_xevent,
GdkEvent *event,
gpointer data);
static void send_xembed_message (GtkSocket *socket,
glong message,
glong detail,
glong data1,
glong data2,
guint32 time);
static gboolean xembed_get_info (GdkWindow *gdk_window,
unsigned long *version,
unsigned long *flags);
/* From Tk */
#define EMBEDDED_APP_WANTS_FOCUS NotifyNormal+20
/* Local data */
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
enum {
PLUG_ADDED,
PLUG_REMOVED,
LAST_SIGNAL
};
static guint socket_signals[LAST_SIGNAL] = { 0 };
static GtkWidgetClass *parent_class = NULL;
GtkType
gtk_socket_get_type (void)
{
static GtkType socket_type = 0;
if (!socket_type)
{
documented necessary changes for 1.4 transition. Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org> * docs/Changes-1.4.txt: documented necessary changes for 1.4 transition. * gtk/gtktext.c: made the adjustments no-construct args, simply provide default adjustments. (gtk_text_destroy): release adjustments. * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the adjustment argument non-construct. * gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here, instead of in finalize. (gtk_progress_get_text_from_value): (gtk_progress_get_current_text): (gtk_progress_set_value): (gtk_progress_get_percentage_from_value): (gtk_progress_get_current_percentage): (gtk_progress_set_percentage): (gtk_progress_configure): ensure an adjustment is present. Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org> * gtk/gtkcolorsel.[hc]: * gtk/gtkcolorseldialog.[hc]: * gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain their parent implementation, use bit fields for boolean values, don't create unused widgets, usage of glib types, braces go on their own lines, function argument alignment, #include directives etc. etc. etc.. * gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h. Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips. * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. * gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer to NULL when the toplevel is getting destroyed. (gtk_menu_set_tearoff_state): same here for the tearoff_window. (gtk_menu_destroy): (gtk_menu_init): store the information of whether we have to readd the initial child ref_count during destruction in a new GtkMenu field needs_destruction_ref_count. * gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it here, those reading: learn from my mistake! ;) in order for set_?adjustment to support a default adjustemnt if invoked with an adjustment pointer of NULL, the code read (pseudo): if (v->adjustment) unref (v->adjustment); if (!adjustment) adjustment = adjustment_new (); if (v->adjustment != adjustment) v->adjustment = ref (adjustment); now imagine the first unref to actually free the old adjustment and adjustment_new() creating a new adjustment from the very same memory portion. here, the latter comparision will unintendedly fail, and all hell breaks loose. (gtk_viewport_set_hadjustment): (gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL after unreferencing it. * gtk/gtkcontainer.[hc]: removed toplevel registration functions: gtk_container_register_toplevel(), gtk_container_unregister_toplevel() and gtk_container_get_toplevels() which had wrong semantics anyways: it didn't reference and copy the list. * gtk/gtkwindow.c: we take over the container toplevel registration bussiness now. windows are registered across multiple destructions, untill they are finalized. the initial implicit reference count users are holding on windows is removed with the first destruction though. (gtk_window_init): ref & sink and set has_user_ref_count, got rid of gtk_container_register_toplevel() call. add window to toplevel_list. (gtk_window_destroy): unref the window if has_user_ref_count is still set, got rid of call to gtk_container_unregister_toplevel(). (gtk_window_finalize): remove window from toplevel list. (gtk_window_list_toplevels): new function to return a newly created list with referenced toplevels. (gtk_window_read_rcfiles): use gtk_window_list_toplevels(). * gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange adjustment a non-construct arg. * gtk/gtkvscale.c (gtk_vscale_class_init): likewise. * gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkrange.c: added some realized checks. (gtk_range_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. remove timer. (gtk_range_get_adjustment): demand create adjustment. * gtk/gtkviewport.c: made h/v adjustment non-construct args. we simply create them on demand now and get rid of them in the destroy handler. (gtk_viewport_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. (gtk_viewport_get_hadjustment): (gtk_viewport_get_vadjustment): (gtk_viewport_size_allocate): demand create h/v adjustment if required. * gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the gtk_widget_real_destroy () functionality. (gtk_widget_real_destroy): reinitialize with a new style, instead of setting widget->style to NULL. Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org> * gtk/gtkcalendar.c: * gtk/gtkbutton.c: ported _get_type() implementation over to GType, either to preserve memchunks allocation facilities, or because Gtk+ 1.0 GtkTypeInfo was still being used. * gtk/gtkobject.[hc]: derive from GObject. ported various functions over. prepare for ::destroy to be emitted multiple times. removed reference tracer magic. chain into GObjectClass.shutdown() to emit ::destroy signal. * gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being fundamental. * gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init() cludge. * gtk/gtksocket.c: * gtk/gtkplug.c: * gtk/gtklayout.c: * gtk/gtklabel.c: * gtk/gtkargcollector.c: * gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT not being a fundamental anymore, and to work with the new type system (nuked fundamental type varargs clutter). * gtk/*.c: install finalize handlers in the GObjectClass part of the class structure. changed direct GTK_OBJECT()->klass accesses to GTK_*_GET_CLASS(). changed direct object_class->type accesses to GTK_CLASS_TYPE(). * gtktypeutils.[hc]: use the reserved fundamental ids provided by GType. made most of the GTK_*() type macros and Gtk* typedefs simple wrappers around macros and types provided by GType. most notably, a significant portion of the old API vanished: GTK_TYPE_MAKE(), GTK_TYPE_SEQNO(), GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST, GTK_TYPE_ARGS, GTK_TYPE_CALLBACK, GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN, GtkTypeQuery, gtk_type_query(), gtk_type_set_varargs_type(), gtk_type_get_varargs_type(), gtk_type_check_object_cast(), gtk_type_check_class_cast(), gtk_type_describe_tree(), gtk_type_describe_heritage(), gtk_type_free(), gtk_type_children_types(), gtk_type_set_chunk_alloc(), gtk_type_register_enum(), gtk_type_register_flags(), gtk_type_parent_class(). replacements, where available are described in ../docs/Changes-1.4.txt. implemented compatibility functions for the remaining API. * configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
static const GTypeInfo socket_info =
{
sizeof (GtkSocketClass),
documented necessary changes for 1.4 transition. Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org> * docs/Changes-1.4.txt: documented necessary changes for 1.4 transition. * gtk/gtktext.c: made the adjustments no-construct args, simply provide default adjustments. (gtk_text_destroy): release adjustments. * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the adjustment argument non-construct. * gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here, instead of in finalize. (gtk_progress_get_text_from_value): (gtk_progress_get_current_text): (gtk_progress_set_value): (gtk_progress_get_percentage_from_value): (gtk_progress_get_current_percentage): (gtk_progress_set_percentage): (gtk_progress_configure): ensure an adjustment is present. Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org> * gtk/gtkcolorsel.[hc]: * gtk/gtkcolorseldialog.[hc]: * gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain their parent implementation, use bit fields for boolean values, don't create unused widgets, usage of glib types, braces go on their own lines, function argument alignment, #include directives etc. etc. etc.. * gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h. Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips. * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. * gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer to NULL when the toplevel is getting destroyed. (gtk_menu_set_tearoff_state): same here for the tearoff_window. (gtk_menu_destroy): (gtk_menu_init): store the information of whether we have to readd the initial child ref_count during destruction in a new GtkMenu field needs_destruction_ref_count. * gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it here, those reading: learn from my mistake! ;) in order for set_?adjustment to support a default adjustemnt if invoked with an adjustment pointer of NULL, the code read (pseudo): if (v->adjustment) unref (v->adjustment); if (!adjustment) adjustment = adjustment_new (); if (v->adjustment != adjustment) v->adjustment = ref (adjustment); now imagine the first unref to actually free the old adjustment and adjustment_new() creating a new adjustment from the very same memory portion. here, the latter comparision will unintendedly fail, and all hell breaks loose. (gtk_viewport_set_hadjustment): (gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL after unreferencing it. * gtk/gtkcontainer.[hc]: removed toplevel registration functions: gtk_container_register_toplevel(), gtk_container_unregister_toplevel() and gtk_container_get_toplevels() which had wrong semantics anyways: it didn't reference and copy the list. * gtk/gtkwindow.c: we take over the container toplevel registration bussiness now. windows are registered across multiple destructions, untill they are finalized. the initial implicit reference count users are holding on windows is removed with the first destruction though. (gtk_window_init): ref & sink and set has_user_ref_count, got rid of gtk_container_register_toplevel() call. add window to toplevel_list. (gtk_window_destroy): unref the window if has_user_ref_count is still set, got rid of call to gtk_container_unregister_toplevel(). (gtk_window_finalize): remove window from toplevel list. (gtk_window_list_toplevels): new function to return a newly created list with referenced toplevels. (gtk_window_read_rcfiles): use gtk_window_list_toplevels(). * gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange adjustment a non-construct arg. * gtk/gtkvscale.c (gtk_vscale_class_init): likewise. * gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkrange.c: added some realized checks. (gtk_range_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. remove timer. (gtk_range_get_adjustment): demand create adjustment. * gtk/gtkviewport.c: made h/v adjustment non-construct args. we simply create them on demand now and get rid of them in the destroy handler. (gtk_viewport_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. (gtk_viewport_get_hadjustment): (gtk_viewport_get_vadjustment): (gtk_viewport_size_allocate): demand create h/v adjustment if required. * gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the gtk_widget_real_destroy () functionality. (gtk_widget_real_destroy): reinitialize with a new style, instead of setting widget->style to NULL. Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org> * gtk/gtkcalendar.c: * gtk/gtkbutton.c: ported _get_type() implementation over to GType, either to preserve memchunks allocation facilities, or because Gtk+ 1.0 GtkTypeInfo was still being used. * gtk/gtkobject.[hc]: derive from GObject. ported various functions over. prepare for ::destroy to be emitted multiple times. removed reference tracer magic. chain into GObjectClass.shutdown() to emit ::destroy signal. * gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being fundamental. * gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init() cludge. * gtk/gtksocket.c: * gtk/gtkplug.c: * gtk/gtklayout.c: * gtk/gtklabel.c: * gtk/gtkargcollector.c: * gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT not being a fundamental anymore, and to work with the new type system (nuked fundamental type varargs clutter). * gtk/*.c: install finalize handlers in the GObjectClass part of the class structure. changed direct GTK_OBJECT()->klass accesses to GTK_*_GET_CLASS(). changed direct object_class->type accesses to GTK_CLASS_TYPE(). * gtktypeutils.[hc]: use the reserved fundamental ids provided by GType. made most of the GTK_*() type macros and Gtk* typedefs simple wrappers around macros and types provided by GType. most notably, a significant portion of the old API vanished: GTK_TYPE_MAKE(), GTK_TYPE_SEQNO(), GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST, GTK_TYPE_ARGS, GTK_TYPE_CALLBACK, GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN, GtkTypeQuery, gtk_type_query(), gtk_type_set_varargs_type(), gtk_type_get_varargs_type(), gtk_type_check_object_cast(), gtk_type_check_class_cast(), gtk_type_describe_tree(), gtk_type_describe_heritage(), gtk_type_free(), gtk_type_children_types(), gtk_type_set_chunk_alloc(), gtk_type_register_enum(), gtk_type_register_flags(), gtk_type_parent_class(). replacements, where available are described in ../docs/Changes-1.4.txt. implemented compatibility functions for the remaining API. * configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) gtk_socket_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GtkSocket),
16, /* n_preallocs */
(GInstanceInitFunc) gtk_socket_init,
};
urg, removed implementation of gtk_marshal_VOID__INT_INT_INT_INT. if Wed Oct 25 20:47:41 2000 Tim Janik <timj@gtk.org> * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): urg, removed implementation of gtk_marshal_VOID__INT_INT_INT_INT. if people do that, couldn't they at least give it a non-standard name? * gtk/gtktextlayout.c: arg! yet another implementation of gtk_marshal_VOID__INT_INT_INT_INT(), is this a conspiracy? * gtk/gtktextbuffer.c: gotcha! captured a vagabonding gtk_marshal_VOID__INT_POINTER_INT() implementation, braught it back home. now i know this _is_ a conspiracy. * gtk/gtkwidget.c (gtk_widget_class_init): marshaller fixups for ::state-changed. * gtk/gtkaccelgroup.c (gtk_accel_group_create_remove): (gtk_accel_group_create_add): marshaller signature fixups. * gtk/gtklistitem.c (gtk_list_item_class_init): signal creation fixups, pass in GTK_TYPE_SCROLL_TYPE instead of GTK_TYPE_ENUM. * gtk/gtkobject.[hc]: removed GTK_CONNECTED flag, it's not valid anymore. Tue Oct 24 23:59:21 2000 Tim Janik <timj@gtk.org> * docs/reference/Makefile.am: disabled SUBDIRS for the moment, since due to the signal system changes, it wouldn't build currently. to be fixed soon. * docs/Changes-2.0.txt: GtkSignal/GSignal updates. * gtk/gtkwidget.c: ::direction_changed takes an enum as argument, so it needs gtk_marshal_VOID__ENUM() instead of gtk_marshal_NONE__UINT(). * gdk/gdk*.c: adapted type registration functions. * gtk/gtkbindings.c: * gtk/gtkaccelgroup.c: operate on GSignalQuery, GtkSignalQuery is gone. * gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType. * gtk/gtkobject.c: (gtk_object_destroy): (gtk_object_shutdown): fixed recursion guards. basically we have to catch the case where any of GObject.shutdown() or gtk_object_destroy() is called during ::destroy, and avoid recursion there. * gtk/gtktypeutils.c: * gtk/maketypes.awk: awk-script hackup to provide gtk_type_init() with boxed_copy/boxed_free. this needs a more general solution based on a publically installed code-generator utility. * gtk/gtktypeutils.[hc]: compat aliased GTK_TYPE_BOXED to G_TYPE_BOXED, glib's gobject has support for that now. define GtkSignalMarshaller in terms of GSignalCMarshaller. Mon Oct 23 09:36:42 2000 Tim Janik <timj@gtk.org> * gtk/gtksignal.[hc]: * gtk/gtkmarshal.[hc]: * gtk/Makefile.am: generate marshallers with glib-genmarshal and don't compile gtkmarshal.c on its own anymore, just include it in gtksignal.c. removed #include <gtkmarshal.h>s all over the place, gtksignal.h takes care of that. * *.c: marshaller name fixups. * gtk/gtkmarshal.list: added a comment briefing the format. Sun Oct 22 23:14:39 2000 Tim Janik <timj@gtk.org> * gtk/gtksignal.[hc]: nuked old implementation. we mostly have compatibility macros here now. more specifically, most of the API is preserved (yes, _most_, nonwithstanding the following exceptions listed, the API is stil lHUGE ;) things that got removed completely: GtkSignalQuery, gtk_signal_query(), gtk_signal_n_emissions(), gtk_signal_n_emissions_by_name(), gtk_signal_handlers_destroy(), gtk_signal_set_funcs(), gtk_signal_handler_pending_by_id(), gtk_signal_add_emission_hook(), gtk_signal_add_emission_hook_full(), gtk_signal_remove_emission_hook(). non-functional functions variants: gtk_signal_add_emission_hook(), gtk_signal_remove_emission_hook(). the GtkCallbackMarshal argument to gtk_signal_connect_full() is not supported anymore. (gtk_signal_compat_matched): new internal function to aid implementation of the compatibility macros, it provides functionality to block/unblock/disconnect handlers based on func/data. * gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType, * *.c: adaptions to new type registration API signatures. Fri Oct 20 15:26:33 2000 Tim Janik <timj@gtk.org> * gtk/gtktypeutils.[hc]: removed G_TYPE_GTK_POINTER cludge.
2000-10-25 22:34:14 +00:00
socket_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkSocket", &socket_info, 0);
}
return socket_type;
}
static void
gtk_socket_finalize (GObject *object)
{
GtkSocket *socket = GTK_SOCKET (object);
g_object_unref (socket->accel_group);
socket->accel_group = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gtk_socket_class_init (GtkSocketClass *class)
{
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
GObjectClass *gobject_class;
gobject_class = (GObjectClass *) class;
widget_class = (GtkWidgetClass*) class;
container_class = (GtkContainerClass*) class;
parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
gobject_class->finalize = gtk_socket_finalize;
widget_class->realize = gtk_socket_realize;
widget_class->unrealize = gtk_socket_unrealize;
widget_class->size_request = gtk_socket_size_request;
widget_class->size_allocate = gtk_socket_size_allocate;
widget_class->hierarchy_changed = gtk_socket_hierarchy_changed;
widget_class->grab_notify = gtk_socket_grab_notify;
widget_class->key_press_event = gtk_socket_key_press_event;
widget_class->focus_in_event = gtk_socket_focus_in_event;
widget_class->focus_out_event = gtk_socket_focus_out_event;
widget_class->focus = gtk_socket_focus;
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
container_class->remove = gtk_socket_remove;
container_class->forall = gtk_socket_forall;
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
socket_signals[PLUG_ADDED] =
g_signal_new ("plug_added",
G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkSocketClass, plug_added),
NULL, NULL,
_gtk_marshal_VOID__VOID,
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
GTK_TYPE_NONE, 0);
socket_signals[PLUG_REMOVED] =
g_signal_new ("plug_removed",
G_OBJECT_CLASS_TYPE (class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkSocketClass, plug_removed),
_gtk_boolean_handled_accumulator, NULL,
_gtk_marshal_BOOLEAN__VOID,
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
G_TYPE_BOOLEAN, 0);
}
static void
gtk_socket_init (GtkSocket *socket)
{
socket->request_width = 0;
socket->request_height = 0;
socket->current_width = 0;
socket->current_height = 0;
socket->plug_window = NULL;
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
socket->plug_widget = NULL;
socket->focus_in = FALSE;
socket->have_size = FALSE;
socket->need_map = FALSE;
socket->accel_group = gtk_accel_group_new ();
g_object_set_data (G_OBJECT (socket->accel_group), "gtk-socket", socket);
}
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
/**
* gtk_socket_new:
*
* Create a new empty #GtkSocket.
*
* Return value: the new #GtkSocket.
**/
GtkWidget*
gtk_socket_new (void)
{
GtkSocket *socket;
socket = g_object_new (GTK_TYPE_SOCKET, NULL);
return GTK_WIDGET (socket);
}
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
/**
* gtk_socket_steal:
* @socket: a #GtkSocket
* @wid: the window ID of an existing toplevel window.
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
*
* Reparents a pre-existing toplevel window into a #GtkSocket. This is
* meant to embed clients that do not know about embedding into a
* #GtkSocket, however doing so is inherently unreliable, and using
* this function is not recommended.
*
* The #GtkSocket must have already be added into a toplevel window
* before you can make this call.
**/
void
gtk_socket_steal (GtkSocket *socket, GdkNativeWindow wid)
{
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
g_return_if_fail (GTK_IS_SOCKET (socket));
g_return_if_fail (GTK_WIDGET_ANCHORED (socket));
if (!GTK_WIDGET_REALIZED (socket))
gtk_widget_realize (GTK_WIDGET (socket));
gtk_socket_add_window (socket, wid, TRUE);
}
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
/**
* gtk_socket_add_id:
* @socket: a #GtkSocket
* @window_id: the window ID of a client participating in the XEMBED protocol.
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
*
* Adds an XEMBED client, such as a #GtkPlug, to the #GtkSocket. The
* client may be in the same process or in a different process.
*
* To embed a #GtkPlug in a #GtkSocket, you can either create the
* #GtkPlug with <literal>gtk_plug_new (0)</literal>, call
* gtk_plug_get_id() to get the window ID of the plug, and then pass that to the
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
* gtk_socket_add_id(), or you can call gtk_socket_get_id() to get the
* window ID for the socket, and call gtk_plug_new() passing in that
* ID.
*
* The #GtkSocket must have already be added into a toplevel window
* before you can make this call.
**/
void
gtk_socket_add_id (GtkSocket *socket, GdkNativeWindow window_id)
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
{
g_return_if_fail (GTK_IS_SOCKET (socket));
g_return_if_fail (GTK_WIDGET_ANCHORED (socket));
if (!GTK_WIDGET_REALIZED (socket))
gtk_widget_realize (GTK_WIDGET (socket));
gtk_socket_add_window (socket, window_id, TRUE);
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
}
/**
* gtk_socket_get_id:
* @socket: a #GtkSocket.
*
* Gets the window ID of a #GtkSocket widget, which can then
* be used to create a client embedded inside the socket, for
* instance with gtk_plug_new().
Doc typo fix. (#68172) * gtk/gtksocket.c (gtk_socket_get_id): Doc typo fix. (#68172) * gtk/gtktreemodel.c (gtk_tree_path_is_descendant): Fix docs. * gtk/gtktreemodel.c (gtk_tree_model_rows_reordered): Document. * gtk/gtkwindow.c (gtk_window_remove_accel_group): Fix docs. * gtk/gtkrc.c (gtk_rc_get_style_by_paths), gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_push_composite_child), gtk/gtkdialog.c (gtk_dialog_new_with_buttons, gtk_dialog_run): Keep gtk-doc from messing up the indentation of inline examples. * gtk/gtkmain.c, gtk/gtkrc.c: Consistently call g_getenv() instead of getenv(). * gtk/gtktreemodel.c, gtk/gtkaccelgroup.c, gtk/gtkclipboard.c, gtk/gtkdnd.c, gtk/gtkiconfactory.c, gtk/gtkrc.c, gtk/gtkstyle.c, gtk/gtkselection.c: Doc fixes. * gtk/gtkaccelmap.c (gtk_accel_map_add_filter, gtk_accel_map_foreach_unfiltered, gtk_accel_map_load_scanner): Document. * gtk/tmpl/gtksocket.sgml: Mention gtk_socket_get_id() instead of GTK_WINDOW_XWINDOW(). (#68172) * gtk/gtk-sections.txt: Move functions which are documented as "private" or "internal" into Private subsections. * gtk/tmpl/gtkdnd.sgml, gtk/tmpl/gtkobject.sgml, gtk/tmpl/gtkrc.sgml, gtk/tmpl/gtktooltips.sgml, gtk/tmpl/gtkwidget.sgml, gtk/tmpl/gtkclipboard.sgml, gtk/tmpl/gtkstyle.sgml, gtk/tmpl/gtkselection.sgml, gtk/tmpl/gtkfeatures.sgml: Minor markup fixes. * gtk/tmpl/gtksignal.sgml: Add link to GLib signal docs. * gtk/tmpl/gtkpreview.sgml, gtk/tmpl/gtktext.sgml, gtk/tmpl/gtktree.sgml: Remove "deprecated" from short desc. * gtk/tmpl/gtkrc.sgml: Correct names of default RC files.
2002-01-08 00:04:57 +00:00
*
* The #GtkSocket must have already be added into a toplevel window
* before you can make this call.
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
*
* Return value: the window ID for the socket
**/
GdkNativeWindow
gtk_socket_get_id (GtkSocket *socket)
{
g_return_val_if_fail (GTK_IS_SOCKET (socket), 0);
g_return_val_if_fail (GTK_WIDGET_ANCHORED (socket), 0);
if (!GTK_WIDGET_REALIZED (socket))
gtk_widget_realize (GTK_WIDGET (socket));
return GDK_WINDOW_XWINDOW (GTK_WIDGET (socket)->window);
}
static void
gtk_socket_realize (GtkWidget *widget)
{
GtkSocket *socket;
GdkWindowAttr attributes;
gint attributes_mask;
XWindowAttributes xattrs;
g_return_if_fail (GTK_IS_SOCKET (widget));
socket = GTK_SOCKET (widget);
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 = GDK_FOCUS_CHANGE_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, socket);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
XGetWindowAttributes (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (widget->window),
&xattrs);
XSelectInput (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW(widget->window),
xattrs.your_event_mask |
SubstructureNotifyMask | SubstructureRedirectMask);
gdk_window_add_filter (widget->window, gtk_socket_filter_func, widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
/* We sync here so that we make sure that if the XID for
* our window is passed to another application, SubstructureRedirectMask
* will be set by the time the other app creates its window.
*/
gdk_flush();
}
static void
gtk_socket_end_embedding (GtkSocket *socket)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket));
gint i;
if (toplevel && GTK_IS_WINDOW (toplevel))
gtk_window_remove_embedded_xid (GTK_WINDOW (toplevel),
GDK_WINDOW_XWINDOW (socket->plug_window));
g_object_unref (socket->plug_window);
socket->plug_window = NULL;
/* Remove from end to avoid indexes shifting. This is evil */
for (i = socket->accel_group->n_accels - 1; i >= 0; i--)
{
GtkAccelGroupEntry *accel_entry = &socket->accel_group->priv_accels[i];
gtk_accel_group_disconnect (socket->accel_group, accel_entry->closure);
}
}
static void
gtk_socket_unrealize (GtkWidget *widget)
{
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
GtkSocket *socket = GTK_SOCKET (widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
if (socket->plug_widget)
{
_gtk_plug_remove_from_socket (GTK_PLUG (socket->plug_widget), socket);
}
else if (socket->plug_window)
{
gtk_socket_end_embedding (socket);
}
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
static void
gtk_socket_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
GtkSocket *socket = GTK_SOCKET (widget);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (socket->plug_widget)
{
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
gtk_widget_size_request (socket->plug_widget, requisition);
}
else
{
if (socket->is_mapped && !socket->have_size && socket->plug_window)
{
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
XSizeHints hints;
long supplied;
gdk_error_trap_push ();
if (XGetWMNormalHints (GDK_DISPLAY(),
GDK_WINDOW_XWINDOW (socket->plug_window),
&hints, &supplied))
{
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
/* This is obsolete, according the X docs, but many programs
* still use it */
if (hints.flags & (PSize | USSize))
{
socket->request_width = hints.width;
socket->request_height = hints.height;
}
else if (hints.flags & PMinSize)
{
socket->request_width = hints.min_width;
socket->request_height = hints.min_height;
}
else if (hints.flags & PBaseSize)
{
socket->request_width = hints.base_width;
socket->request_height = hints.base_height;
}
}
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
socket->have_size = TRUE; /* don't check again? */
gdk_error_trap_pop ();
}
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (socket->is_mapped && socket->have_size)
{
requisition->width = MAX (socket->request_width, 1);
requisition->height = MAX (socket->request_height, 1);
}
else
{
requisition->width = 1;
requisition->height = 1;
}
}
}
static void
gtk_socket_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkSocket *socket;
g_return_if_fail (GTK_IS_SOCKET (widget));
g_return_if_fail (allocation != NULL);
socket = GTK_SOCKET (widget);
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_move_resize (widget->window,
allocation->x, allocation->y,
allocation->width, allocation->height);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (socket->plug_widget)
{
GtkAllocation child_allocation;
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.width = allocation->width;
child_allocation.height = allocation->height;
gtk_widget_size_allocate (socket->plug_widget, &child_allocation);
}
else if (socket->plug_window)
{
gdk_error_trap_push ();
if (!socket->need_map &&
(allocation->width == socket->current_width) &&
(allocation->height == socket->current_height))
{
gtk_socket_send_configure_event (socket);
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket - allocated no change: %d %d",
allocation->width, allocation->height));
}
else
{
gdk_window_move_resize (socket->plug_window,
0, 0,
allocation->width, allocation->height);
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket - allocated: %d %d",
allocation->width, allocation->height));
socket->current_width = allocation->width;
socket->current_height = allocation->height;
}
if (socket->need_map)
{
gdk_window_show (socket->plug_window);
socket->need_map = FALSE;
}
gdk_flush ();
gdk_error_trap_pop ();
}
}
}
typedef struct
{
guint accel_key;
GdkModifierType accel_mods;
} GrabbedKey;
static void
activate_key (GtkAccelGroup *accel_group,
GrabbedKey *grabbed_key)
{
XEvent xevent;
GdkEvent *gdk_event = gtk_get_current_event ();
GtkSocket *socket = g_object_get_data (G_OBJECT (accel_group), "gtk-socket");
if (gdk_event && gdk_event->type == GDK_KEY_PRESS && socket->plug_window)
{
xevent.xkey.type = KeyPress;
xevent.xkey.window = GDK_WINDOW_XWINDOW (socket->plug_window);
xevent.xkey.root = GDK_ROOT_WINDOW ();
xevent.xkey.subwindow = None;
xevent.xkey.time = gdk_event->key.time;
xevent.xkey.x = 0;
xevent.xkey.y = 0;
xevent.xkey.x_root = 0;
xevent.xkey.y_root = 0;
xevent.xkey.state = gdk_event->key.state;
xevent.xkey.keycode = gdk_event->key.hardware_keycode;
xevent.xkey.same_screen = True;
gdk_error_trap_push ();
XSendEvent (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (socket->plug_window),
False, KeyPressMask, &xevent);
gdk_flush ();
gdk_error_trap_pop ();
}
if (gdk_event)
gdk_event_free (gdk_event);
}
static gboolean
find_accel_key (GtkAccelKey *key,
GClosure *closure,
gpointer data)
{
GrabbedKey *grabbed_key = data;
return (key->accel_key == grabbed_key->accel_key &&
key->accel_mods == grabbed_key->accel_mods);
}
static void
add_grabbed_key (GtkSocket *socket,
guint keyval,
GdkModifierType modifiers)
{
GClosure *closure;
GrabbedKey *grabbed_key;
grabbed_key = g_new (GrabbedKey, 1);
grabbed_key->accel_key = keyval;
grabbed_key->accel_mods = modifiers;
if (gtk_accel_group_find (socket->accel_group,
find_accel_key,
&grabbed_key))
{
g_warning ("GtkSocket: request to add already present grabbed key %u,%#x\n",
keyval, modifiers);
g_free (grabbed_key);
return;
}
closure = g_cclosure_new (G_CALLBACK (activate_key), grabbed_key, (GClosureNotify)g_free);
gtk_accel_group_connect (socket->accel_group, keyval, modifiers, GTK_ACCEL_LOCKED,
closure);
}
static void
remove_grabbed_key (GtkSocket *socket,
guint keyval,
GdkModifierType modifiers)
{
gint i;
for (i = 0; i < socket->accel_group->n_accels; i++)
{
GtkAccelGroupEntry *accel_entry = &socket->accel_group->priv_accels[i];
if (accel_entry->key.accel_key == keyval &&
accel_entry->key.accel_mods == modifiers)
{
gtk_accel_group_disconnect (socket->accel_group,
accel_entry->closure);
return;
}
}
g_warning ("GtkSocket: request to remove non-present grabbed key %u,%#x\n",
keyval, modifiers);
}
static gboolean
toplevel_focus_in_handler (GtkWidget *toplevel,
GdkEventFocus *event,
GtkSocket *socket)
{
/* It appears spurious focus in events can occur when
* the window is hidden. So we'll just check to see if
* the window is visible before actually handling the
* event. (Comment from gtkwindow.c)
*/
if (GTK_WIDGET_VISIBLE (toplevel))
send_xembed_message (socket, XEMBED_WINDOW_ACTIVATE, 0, 0, 0,
gtk_get_current_event_time ()); /* Will be GDK_CURRENT_TIME */
return FALSE;
}
static gboolean
toplevel_focus_out_handler (GtkWidget *toplevel,
GdkEventFocus *event,
GtkSocket *socket)
{
send_xembed_message (socket, XEMBED_WINDOW_DEACTIVATE, 0, 0, 0,
gtk_get_current_event_time ()); /* Will be GDK_CURRENT_TIME */
return FALSE;
}
static void
gtk_socket_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel)
{
GtkSocket *socket = GTK_SOCKET (widget);
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (toplevel && !GTK_IS_WINDOW (toplevel))
toplevel = NULL;
if (toplevel != socket->toplevel)
{
if (socket->toplevel)
{
gtk_window_remove_accel_group (GTK_WINDOW (socket->toplevel), socket->accel_group);
gtk_signal_disconnect_by_func (GTK_OBJECT (socket->toplevel), GTK_SIGNAL_FUNC (toplevel_focus_in_handler), socket);
gtk_signal_disconnect_by_func (GTK_OBJECT (socket->toplevel), GTK_SIGNAL_FUNC (toplevel_focus_out_handler), socket);
}
socket->toplevel = toplevel;
if (toplevel)
{
gtk_window_add_accel_group (GTK_WINDOW (socket->toplevel), socket->accel_group);
gtk_signal_connect (GTK_OBJECT (socket->toplevel), "focus_in_event",
GTK_SIGNAL_FUNC (toplevel_focus_in_handler), socket);
gtk_signal_connect (GTK_OBJECT (socket->toplevel), "focus_out_event",
GTK_SIGNAL_FUNC (toplevel_focus_out_handler), socket);
}
}
}
static void
gtk_socket_grab_notify (GtkWidget *widget,
gboolean was_grabbed)
{
GtkSocket *socket = GTK_SOCKET (widget);
if (!socket->same_app)
send_xembed_message (GTK_SOCKET (widget),
was_grabbed ? XEMBED_MODALITY_OFF : XEMBED_MODALITY_ON,
0, 0, 0, gtk_get_current_event_time ());
}
static gboolean
gtk_socket_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
GtkSocket *socket = GTK_SOCKET (widget);
if (GTK_WIDGET_HAS_FOCUS (socket) && socket->plug_window && !socket->plug_widget)
{
XEvent xevent;
xevent.xkey.type = KeyPress;
xevent.xkey.display = GDK_WINDOW_XDISPLAY (event->window);
xevent.xkey.window = GDK_WINDOW_XWINDOW (socket->plug_window);
xevent.xkey.root = GDK_ROOT_WINDOW ();
xevent.xkey.time = event->time;
/* FIXME, the following might cause problems for non-GTK apps */
xevent.xkey.x = 0;
xevent.xkey.y = 0;
xevent.xkey.x_root = 0;
xevent.xkey.y_root = 0;
xevent.xkey.state = event->state;
xevent.xkey.keycode = event->hardware_keycode;
xevent.xkey.same_screen = TRUE; /* FIXME ? */
gdk_error_trap_push ();
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
XSendEvent (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (socket->plug_window),
False, NoEventMask, &xevent);
gdk_flush ();
gdk_error_trap_pop ();
return TRUE;
}
else
return FALSE;
}
static gboolean
gtk_socket_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
{
GtkSocket *socket = GTK_SOCKET (widget);
if (socket->plug_window)
send_xembed_message (socket, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT, 0, 0,
gtk_get_current_event_time ());
return TRUE;
}
static gboolean
gtk_socket_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
{
GtkSocket *socket = GTK_SOCKET (widget);
#if 0
GtkWidget *toplevel;
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
toplevel = gtk_widget_get_toplevel (widget);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (toplevel && GTK_IS_WINDOW (toplevel))
{
XSetInputFocus (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (toplevel->window),
RevertToParent, CurrentTime); /* FIXME? */
}
#endif
if (socket->plug_window)
{
send_xembed_message (socket, XEMBED_FOCUS_OUT, 0, 0, 0,
gtk_get_current_event_time ());
}
socket->focus_in = FALSE;
return TRUE;
}
static void
gtk_socket_claim_focus (GtkSocket *socket)
{
socket->focus_in = TRUE;
/* Oh, the trickery... */
GTK_WIDGET_SET_FLAGS (socket, GTK_CAN_FOCUS);
gtk_widget_grab_focus (GTK_WIDGET (socket));
GTK_WIDGET_UNSET_FLAGS (socket, GTK_CAN_FOCUS);
/* FIXME: we might grab the focus even if we don't have
* it as an app... (and see _focus_in ()) */
if (socket->plug_window)
{
#if 0
gdk_error_trap_push ();
XSetInputFocus (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (socket->plug_window),
RevertToParent, GDK_CURRENT_TIME);
gdk_flush ();
gdk_error_trap_pop ();
#endif
}
}
static gboolean
gtk_socket_focus (GtkWidget *widget, GtkDirectionType direction)
{
GtkSocket *socket;
gint detail = -1;
g_return_val_if_fail (GTK_IS_SOCKET (widget), FALSE);
socket = GTK_SOCKET (widget);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (socket->plug_widget)
return gtk_widget_child_focus (socket->plug_widget, direction);
if (!GTK_WIDGET_HAS_FOCUS (widget))
{
switch (direction)
{
case GTK_DIR_UP:
case GTK_DIR_LEFT:
case GTK_DIR_TAB_BACKWARD:
detail = XEMBED_FOCUS_LAST;
break;
case GTK_DIR_DOWN:
case GTK_DIR_RIGHT:
case GTK_DIR_TAB_FORWARD:
detail = XEMBED_FOCUS_FIRST;
break;
}
send_xembed_message (socket, XEMBED_FOCUS_IN, detail, 0, 0,
gtk_get_current_event_time ());
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_grab_focus (widget);
return TRUE;
}
else
return FALSE;
#if 0
if (!socket->focus_in && socket->plug_window)
{
XEvent xevent;
gtk_socket_claim_focus (socket);
xevent.xkey.type = KeyPress;
xevent.xkey.display = GDK_DISPLAY ();
xevent.xkey.window = GDK_WINDOW_XWINDOW (socket->plug_window);
xevent.xkey.root = GDK_ROOT_WINDOW (); /* FIXME */
xevent.xkey.time = GDK_CURRENT_TIME; /* FIXME */
/* FIXME, the following might cause big problems for
* non-GTK apps */
xevent.xkey.x = 0;
xevent.xkey.y = 0;
xevent.xkey.x_root = 0;
xevent.xkey.y_root = 0;
xevent.xkey.state = 0;
xevent.xkey.same_screen = TRUE; /* FIXME ? */
switch (direction)
{
case GTK_DIR_UP:
xevent.xkey.keycode = XKeysymToKeycode(GDK_DISPLAY(), GDK_Up);
break;
case GTK_DIR_DOWN:
xevent.xkey.keycode = XKeysymToKeycode(GDK_DISPLAY(), GDK_Down);
break;
case GTK_DIR_LEFT:
xevent.xkey.keycode = XKeysymToKeycode(GDK_DISPLAY(), GDK_Left);
break;
case GTK_DIR_RIGHT:
xevent.xkey.keycode = XKeysymToKeycode(GDK_DISPLAY(), GDK_Right);
break;
case GTK_DIR_TAB_FORWARD:
xevent.xkey.keycode = XKeysymToKeycode(GDK_DISPLAY(), GDK_Tab);
break;
case GTK_DIR_TAB_BACKWARD:
xevent.xkey.keycode = XKeysymToKeycode(GDK_DISPLAY(), GDK_Tab);
xevent.xkey.state = ShiftMask;
break;
}
gdk_error_trap_push ();
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
XSendEvent (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (socket->plug_window),
False, NoEventMask, &xevent);
gdk_flush();
gdk_error_trap_pop ();
return TRUE;
}
else
{
return FALSE;
}
#endif
}
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
static void
gtk_socket_remove (GtkContainer *container,
GtkWidget *child)
{
GtkSocket *socket = GTK_SOCKET (container);
g_return_if_fail (child == socket->plug_widget);
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
_gtk_plug_remove_from_socket (GTK_PLUG (socket->plug_widget), socket);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
}
static void
gtk_socket_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
GtkSocket *socket = GTK_SOCKET (container);
if (socket->plug_widget)
(* callback) (socket->plug_widget, callback_data);
}
static void
gtk_socket_send_configure_event (GtkSocket *socket)
{
XEvent event;
g_return_if_fail (socket->plug_window != NULL);
event.xconfigure.type = ConfigureNotify;
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
event.xconfigure.display = GDK_DISPLAY ();
event.xconfigure.event = GDK_WINDOW_XWINDOW (socket->plug_window);
event.xconfigure.window = GDK_WINDOW_XWINDOW (socket->plug_window);
event.xconfigure.x = 0;
event.xconfigure.y = 0;
event.xconfigure.width = GTK_WIDGET(socket)->allocation.width;
event.xconfigure.height = GTK_WIDGET(socket)->allocation.height;
event.xconfigure.border_width = 0;
event.xconfigure.above = None;
event.xconfigure.override_redirect = False;
gdk_error_trap_push ();
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
XSendEvent (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (socket->plug_window),
False, NoEventMask, &event);
gdk_flush ();
gdk_error_trap_pop ();
}
static void
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
gtk_socket_add_window (GtkSocket *socket,
GdkNativeWindow xid,
gboolean need_reparent)
{
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
GtkWidget *widget = GTK_WIDGET (socket);
gpointer user_data = NULL;
socket->plug_window = gdk_window_lookup (xid);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (socket->plug_window)
{
g_object_ref (socket->plug_window);
gdk_window_get_user_data (socket->plug_window, &user_data);
}
if (user_data) /* A widget's window in this process */
{
GtkWidget *child_widget = user_data;
if (!GTK_IS_PLUG (child_widget))
{
g_warning (G_STRLOC "Can't add non-GtkPlug to GtkSocket");
socket->plug_window = NULL;
gdk_error_trap_pop ();
return;
}
_gtk_plug_add_to_socket (GTK_PLUG (child_widget), socket);
}
else /* A foreign window */
{
GtkWidget *toplevel;
GdkDragProtocol protocol;
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
unsigned long version;
unsigned long flags;
gdk_error_trap_push ();
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (!socket->plug_window)
{
socket->plug_window = gdk_window_foreign_new (xid);
if (!socket->plug_window) /* was deleted before we could get it */
{
gdk_error_trap_pop ();
return;
}
}
XSelectInput (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW(socket->plug_window),
StructureNotifyMask | PropertyChangeMask);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (gdk_error_trap_pop ())
{
gdk_window_unref (socket->plug_window);
socket->plug_window = NULL;
return;
}
/* OK, we now will reliably get destroy notification on socket->plug_window */
gdk_error_trap_push ();
if (need_reparent)
{
gdk_window_hide (socket->plug_window); /* Shouldn't actually be necessary for XEMBED, but just in case */
gdk_window_reparent (socket->plug_window, widget->window, 0, 0);
}
socket->have_size = FALSE;
socket->xembed_version = -1;
if (xembed_get_info (socket->plug_window, &version, &flags))
{
socket->xembed_version = version;
socket->is_mapped = (flags & XEMBED_MAPPED) != 0;
}
else
{
/* FIXME, we should probably actually check the state before we started */
socket->is_mapped = need_reparent ? TRUE : FALSE;
}
socket->need_map = socket->is_mapped;
if (gdk_drag_get_protocol (xid, &protocol))
gtk_drag_dest_set_proxy (GTK_WIDGET (socket), socket->plug_window,
protocol, TRUE);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
gdk_flush ();
gdk_error_trap_pop ();
gdk_window_add_filter (socket->plug_window,
gtk_socket_filter_func, socket);
/* Add a pointer to the socket on our toplevel window */
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket));
if (toplevel && GTK_IS_WINDOW (toplevel))
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
gtk_window_add_embedded_xid (GTK_WINDOW (toplevel), xid);
gtk_widget_queue_resize (GTK_WIDGET (socket));
}
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
if (socket->plug_window)
g_signal_emit (G_OBJECT (socket), socket_signals[PLUG_ADDED], 0);
}
static void
send_xembed_message (GtkSocket *socket,
glong message,
glong detail,
glong data1,
glong data2,
guint32 time)
{
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket: Sending XEMBED message of type %ld", message));
if (socket->plug_window)
{
XEvent xevent;
xevent.xclient.window = GDK_WINDOW_XWINDOW (socket->plug_window);
xevent.xclient.type = ClientMessage;
xevent.xclient.message_type = gdk_x11_get_xatom_by_name ("_XEMBED");
xevent.xclient.format = 32;
xevent.xclient.data.l[0] = time;
xevent.xclient.data.l[1] = message;
xevent.xclient.data.l[2] = detail;
xevent.xclient.data.l[3] = data1;
xevent.xclient.data.l[4] = data2;
gdk_error_trap_push ();
Make gdkx.h the only installed header from gdk/x11. All structures in Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com> Make gdkx.h the only installed header from gdk/x11. All structures in gdk/x11 are opaque. * gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h: Don't install gdk{drawable,pixmap,window}-x11.h. * gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c: Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11, GdkVisualClass into C files. * gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static. * gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c, gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c} Add public functions to replace previously exported direct structure access. gdk_x11_colormap_get_{xdisplay,xcolormap} gdk_x11_cursor_get_{xdisplay,xcursor}, gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual, gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage}, gdk_x11_gc_get_{xdisplay,ximage} * gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo, GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals. Fix a number of variables and functions that were exported "accidentally" from GDK. * gdk/**.[ch]: gdk => _gdk for gdk_visual_init, gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit, gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data, gdk_event_notify, gdk_queued_events, gdk_queued_tail, gdk_event_new, gdk_events_queue, gdk_events_unqueue, gdk_event_queue_find_first, gdk_event_queue_remove_link, gdk_event_queue_append, gdk_event_button_generate, gdk_debug_flags, gdk_default_filters, gdk_parent_root. * gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c, gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}: gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks, gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window, gdk_use_xshm, gdk_input_ignore_core. * gdk/x11/xsettings-common.h (xsettings_list_insert): Add #defines to namespace functions into the private _gdk_ namespace. * gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window () to replace gdk_parent_root exported variable. Adjust and deprecate GDK_ROOT_PARENT(). * demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix GDK_ROOT_PARENT usage, remove includes of port-specific headers. * gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for _gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core, gdk_input_devices, _gdk_input_windows, gdk_init_input_core. * gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c} docs/Changes-2.0.txt: Remove gdk_wm_protocols, gdk_wm_delete_window functions, gdk_wm_take_focus, use gdk_atom_intern() instead. * gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h} gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h} gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h} gtk/gtkselection.c Unexport gdk_selection_property, just use gdk_atom_intern ("GDK_SELECTION"). * gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}: Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type, GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate, GdkVisualprivate, gdk_x11_gc_flush. Make a number of public exports of variables into functions to increase encapsulation. * gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer, move to gdkinternals.h. Add gdk_device_get_core_pointer (). * gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code, gdk_error_warnings. * gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h} docs/Changes-2.0.txt: s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen() s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow() Add gdk_x11_get_default_xdisplay(). * gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class, Don't export gdk_progclass, move --class command line option and handling to common portion of GDK. Miscellaneous fixes: * gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix g_return_val_if_fail that should have been g_return_if_fail. * gdk/gdkinternals.h gdk/gdkprivate.h: Move gdk_synthesize_window_state() to the semi-public gdkprivate.h. * gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded X11 dependency. * gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO: Remove unused gdk_key_repeat_disable/restore. * linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def: Remove unused gdk_null_window_warnings variable. * gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox; it can be retrieved from the repository; it is too far from functional to be worth having people check out; it would be easier to start from scratch, I suspect. * gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID(). * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. * gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c: Fix some accidentally global variables and unused global variables. Add some space for future expansion to multihead. * gdk/gdkdrawable.h: Add four reserved function pointers for future expansion of GdkDrawableClass. * gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
XSendEvent (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (socket->plug_window),
False, NoEventMask, &xevent);
gdk_flush ();
gdk_error_trap_pop ();
}
}
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
static gboolean
xembed_get_info (GdkWindow *gdk_window,
unsigned long *version,
unsigned long *flags)
{
Display *display = GDK_WINDOW_XDISPLAY (gdk_window);
Window window = GDK_WINDOW_XWINDOW (gdk_window);
Atom xembed_info_atom = gdk_x11_get_xatom_by_name ("_XEMBED_INFO");
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
Atom type;
int format;
unsigned long nitems, bytes_after;
unsigned char *data;
unsigned long *data_long;
int status;
gdk_error_trap_push();
status = XGetWindowProperty (display, window,
xembed_info_atom,
0, 2, False,
xembed_info_atom, &type, &format,
&nitems, &bytes_after, &data);
gdk_error_trap_pop();
if (status != Success)
return FALSE; /* Window vanished? */
if (type == None) /* No info property */
return FALSE;
if (type != xembed_info_atom)
{
g_warning ("_XEMBED_INFO property has wrong type\n");
return FALSE;
}
if (nitems < 2)
{
g_warning ("_XEMBED_INFO too short\n");
XFree (data);
return FALSE;
}
data_long = (unsigned long *)data;
if (version)
*version = data_long[0];
if (flags)
*flags = data_long[1] & XEMBED_MAPPED;
XFree (data);
return TRUE;
}
static void
handle_xembed_message (GtkSocket *socket,
glong message,
glong detail,
glong data1,
glong data2,
guint32 time)
{
switch (message)
{
case XEMBED_EMBEDDED_NOTIFY:
case XEMBED_WINDOW_ACTIVATE:
case XEMBED_WINDOW_DEACTIVATE:
case XEMBED_MODALITY_ON:
case XEMBED_MODALITY_OFF:
case XEMBED_FOCUS_IN:
case XEMBED_FOCUS_OUT:
g_warning ("GtkSocket: Invalid _XEMBED message of type %ld received", message);
break;
case XEMBED_REQUEST_FOCUS:
gtk_socket_claim_focus (socket);
break;
case XEMBED_FOCUS_NEXT:
case XEMBED_FOCUS_PREV:
{
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket));
if (toplevel)
{
gtk_widget_child_focus (toplevel,
(message == XEMBED_FOCUS_NEXT ?
GTK_DIR_TAB_FORWARD : GTK_DIR_TAB_BACKWARD));
}
break;
}
case XEMBED_GTK_GRAB_KEY:
add_grabbed_key (socket, data1, data2);
break;
case XEMBED_GTK_UNGRAB_KEY:
remove_grabbed_key (socket, data1, data2);
break;
case XEMBED_GRAB_KEY:
case XEMBED_UNGRAB_KEY:
break;
default:
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket: Ignoring unknown _XEMBED message of type %ld", message));
break;
}
}
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
static void
map_request (GtkSocket *socket)
{
if (!socket->is_mapped)
{
socket->is_mapped = TRUE;
socket->need_map = TRUE;
gtk_widget_queue_resize (GTK_WIDGET (socket));
}
}
static void
unmap_notify (GtkSocket *socket)
{
if (socket->is_mapped)
{
socket->is_mapped = FALSE;
gtk_widget_queue_resize (GTK_WIDGET (socket));
}
}
static GdkFilterReturn
gtk_socket_filter_func (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
{
GtkSocket *socket;
GtkWidget *widget;
XEvent *xevent;
GdkFilterReturn return_val;
socket = GTK_SOCKET (data);
widget = GTK_WIDGET (socket);
xevent = (XEvent *)gdk_xevent;
return_val = GDK_FILTER_CONTINUE;
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (socket->plug_widget)
return return_val;
switch (xevent->type)
{
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
case ClientMessage:
if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name ("_XEMBED"))
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
{
handle_xembed_message (socket,
xevent->xclient.data.l[1],
xevent->xclient.data.l[2],
xevent->xclient.data.l[3],
xevent->xclient.data.l[4],
xevent->xclient.data.l[0]);
return_val = GDK_FILTER_REMOVE;
}
break;
case CreateNotify:
{
XCreateWindowEvent *xcwe = &xevent->xcreatewindow;
if (!socket->plug_window)
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
{
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
gtk_socket_add_window (socket, xcwe->window, FALSE);
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
if (socket->plug_window)
{
socket->request_width = xcwe->width;
socket->request_height = xcwe->height;
socket->have_size = TRUE;
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket - window created with size: %d %d",
socket->request_width,
socket->request_height));
}
}
return_val = GDK_FILTER_REMOVE;
break;
}
case ConfigureRequest:
{
XConfigureRequestEvent *xcre = &xevent->xconfigurerequest;
if (!socket->plug_window)
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
gtk_socket_add_window (socket, xcre->window, FALSE);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (socket->plug_window)
{
if (xcre->value_mask & (CWWidth | CWHeight))
{
socket->request_width = xcre->width;
socket->request_height = xcre->height;
socket->have_size = TRUE;
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket - configure request: %d %d",
socket->request_width,
socket->request_height));
gtk_widget_queue_resize (widget);
}
else if (xcre->value_mask & (CWX | CWY))
{
gtk_socket_send_configure_event (socket);
}
/* Ignore stacking requests. */
return_val = GDK_FILTER_REMOVE;
}
break;
}
case DestroyNotify:
{
XDestroyWindowEvent *xdwe = &xevent->xdestroywindow;
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
/* Note that we get destroy notifies both from SubstructureNotify on
* our window and StructureNotify on socket->plug_window
*/
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (socket->plug_window && (xdwe->window == GDK_WINDOW_XWINDOW (socket->plug_window)))
{
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
gboolean result;
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket - destroy notify"));
gdk_window_destroy_notify (socket->plug_window);
gtk_socket_end_embedding (socket);
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
g_object_ref (widget);
g_signal_emit (G_OBJECT (widget), socket_signals[PLUG_REMOVED], 0, &result);
if (!result)
gtk_widget_destroy (widget);
g_object_unref (widget);
return_val = GDK_FILTER_REMOVE;
}
break;
}
case FocusIn:
if (xevent->xfocus.mode == EMBEDDED_APP_WANTS_FOCUS)
{
gtk_socket_claim_focus (socket);
}
else if (xevent->xfocus.detail == NotifyInferior)
{
#if 0
GtkWidget *toplevel;
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
toplevel = gtk_widget_get_toplevel (widget);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (toplevel && GTK_IS_WINDOW (topelevel))
{
XSetInputFocus (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (toplevel->window),
RevertToParent, CurrentTime); /* FIXME? */
}
#endif
}
return_val = GDK_FILTER_REMOVE;
break;
case FocusOut:
return_val = GDK_FILTER_REMOVE;
break;
case MapRequest:
if (!socket->plug_window)
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
gtk_socket_add_window (socket, xevent->xmaprequest.window, FALSE);
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (socket->plug_window)
{
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket - Map Request"));
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
map_request (socket);
return_val = GDK_FILTER_REMOVE;
}
break;
case PropertyNotify:
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
if (socket->plug_window &&
xevent->xproperty.window == GDK_WINDOW_XWINDOW (socket->plug_window))
{
GdkDragProtocol protocol;
if ((xevent->xproperty.atom == gdk_x11_get_xatom_by_name ("XdndAware")) ||
(xevent->xproperty.atom == gdk_x11_get_xatom_by_name ("_MOTIF_DRAG_RECEIVER_INFO")))
{
gdk_error_trap_push ();
if (gdk_drag_get_protocol (xevent->xproperty.window, &protocol))
gtk_drag_dest_set_proxy (GTK_WIDGET (socket),
socket->plug_window,
protocol, TRUE);
gdk_flush ();
gdk_error_trap_pop ();
}
else if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name ("_XEMBED_INFO"))
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
{
unsigned long flags;
if (xembed_get_info (socket->plug_window, NULL, &flags))
{
gboolean was_mapped = socket->is_mapped;
gboolean is_mapped = (flags & XEMBED_MAPPED) != 0;
if (was_mapped != is_mapped)
{
if (is_mapped)
map_request (socket);
else
{
gdk_error_trap_push ();
gdk_window_show (socket->plug_window);
gdk_flush ();
gdk_error_trap_pop ();
unmap_notify (socket);
}
}
}
}
return_val = GDK_FILTER_REMOVE;
}
break;
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
case ReparentNotify:
{
XReparentEvent *xre = &xevent->xreparent;
if (!socket->plug_window && xre->parent == GDK_WINDOW_XWINDOW (widget->window))
{
gtk_socket_add_window (socket, xre->window, FALSE);
if (socket->plug_window)
{
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket - window reparented"));
Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not Wed Jul 4 22:35:40 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtklabel.c gtk/gtkmenubar.c gtk/gtktreeviewcolumn.c gtk/gtkwidget.c: Check GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel (widget)), not GTK_WIDGET_GET_ANCESTOR ... see http://mail.gnome.org/archives/gtk-devel-list/2001-July/msg00072.html. Indicate the best practice in the docs for gtk_widget_get_toplevel(). * gtk/gtkwidget.[ch]: Expose a private _gtk_widget_hierarchy_changed(), so GtkPlug can give the correct signals when transforming from a child to a toplevel. * gtk/gtkdnd.c (gtk_drag_dest_hierarchy_changed): Handle reparentation correctly. * gtk/gtkwidget.c (gtk_widget_propagate_hierarchy_changed): Propagate the previous_toplevel argument down properly. * gtk/gtklabel.c (gtk_label_finalize): Fix unrefing of wrong atr list. * gtk/gtkplug.[ch]: Add an "embedded" signal. * gtk/gtksocket.[ch]: Add "child_added", "child_removed" signals. * gtk/gtkplug.[ch] gtk/gtksocket.[ch]: Add functions gtk_plug_get_id(), gtk_socket_get_id(), to avoid the user having to worry about realization, and gdkx.h. * tests/testsocket.c: Extend to try out the new signals and gtk_plug/socket_get_id(). * gtk/gtklabel.c (gtk_label_set_pattern_internal): Fix setting of underline attributes. * gdk/x11/gdkevents-x11.c (gdk_event_translate): Ignore DestroyNotify events from SubstructureNotifyMask * gdk/x11/gdkwindow-x11.c (gdk_window_reparent): Switch GDK_WINDOW_TYPE (window) as needed. * gdk/x11/gdkwindow-x11.c (gdk_window_new): Clean up, allow creation of toplevel windows as children of foreign windows. * gtk/gtkplug.c: Remove hacks involving changing private fields of GdkWindow. * gtk/gtkplug.[ch] gtk/gtksocket.c: Work to make exactly the same signals and notification be emitted for local embedding as for inter-process embedding.
2001-07-05 02:58:34 +00:00
}
return_val = GDK_FILTER_REMOVE;
}
break;
}
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
case UnmapNotify:
if (socket->plug_window &&
xevent->xunmap.window == GDK_WINDOW_XWINDOW (socket->plug_window))
{
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
GTK_NOTE(PLUGSOCKET,
g_message ("GtkSocket - Unmap notify"));
unmap_notify (socket);
return_val = GDK_FILTER_REMOVE;
}
break;
For XEMBED embedding add a _XEMBED_INFO property to the client with Mon Jul 2 16:53:25 2001 Owen Taylor <otaylor@redhat.com> * gtk/xembed.h gtk/gtkplug.c gtk/gtksocket.c: For XEMBED embedding add a _XEMBED_INFO property to the client with version number and a "mapped" flags. Use the mapped flag instead of the racy MapRequestEvent * gtk/gtksocket.c: Clean up the gtk_socket_steal() code to reliably set things (when the child is a passive embedder participating in the XEMBED protocol) intead of just being a hack for embedding non-participating programs. Fix various bugs and race conditions. * gtk/gtksocket.[ch] gtk/gtkplug.[ch]: Make local embedding work by simply making the GtkSocket the gtk parent of the GtkPlug. Set a flag in this case and make the GtkPlug work like a normal container by overriding methods such as check_resize and "chaining past" GtkWindow to GtkBin. * gtk/gtkentry.c (gtk_entry_real_activate) gtk/gtkmain.c (gtk_propagate_event): Eliminate use of gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW). * gtk/gtkwidget.c (gtk_widget_get_toplevel, gtk_widget_get_ancestor): Explain why gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW) might not give the expected result and recommend an alternative. * tests/testsocket.c tests/testsocket_child.c tests/testsocket_common.c tests/Makefile.am: Extended to test different type of adding plugs to sockets (local,active,passive), and to test mapping/unmapping the plug. * gdk/gdkwindow.c (_gdk_window_destroy_hierarchy): Don't mark the window as destroyed until after we called _gdk_windowing_window_destroy(). (_gdk_windowing_window_destroy() may use GDK functions on the window.) * gdk/x11/gdkinput.c: Remove the check for finalization - devices can be finalized under some circumnstances. * gdk/x11/gdkinput-x11.c (gdk_input_device_new): Fix small problem with GDK_TYPE_DEVICE.
2001-07-03 14:14:30 +00:00
}
return return_val;
}