本文整理汇总了C++中GTK_PLUG函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_PLUG函数的具体用法?C++ GTK_PLUG怎么用?C++ GTK_PLUG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_PLUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: egg_tray_icon_send_message
guint
egg_tray_icon_send_message (EggTrayIcon *icon,
gint timeout,
const gchar *message,
gint len)
{
guint stamp;
g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), 0);
g_return_val_if_fail (timeout >= 0, 0);
g_return_val_if_fail (message != NULL, 0);
if (icon->manager_window == None)
return 0;
if (len < 0)
len = strlen (message);
stamp = icon->stamp++;
/* Get ready to send the message */
egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_BEGIN_MESSAGE,
(Window)gtk_plug_get_id (GTK_PLUG (icon)),
timeout, len, stamp);
/* Now to send the actual message */
gdk_error_trap_push ();
while (len > 0)
{
XClientMessageEvent ev;
Display *xdisplay;
xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
ev.type = ClientMessage;
ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon));
ev.format = 8;
ev.message_type = XInternAtom (xdisplay,
"_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
if (len > 20)
{
memcpy (&ev.data, message, 20);
len -= 20;
message += 20;
}
else
{
memcpy (&ev.data, message, len);
len = 0;
}
XSendEvent (xdisplay,
icon->manager_window, False, StructureNotifyMask, (XEvent *)&ev);
XSync (xdisplay, False);
}
gdk_error_trap_pop ();
return stamp;
}
示例2: matecomponent_plug_button_event
static gboolean
matecomponent_plug_button_event (GtkWidget *widget,
GdkEventButton *event)
{
#if defined (GDK_WINDOWING_X11)
XEvent xevent;
#endif
g_return_val_if_fail (MATECOMPONENT_IS_PLUG (widget), FALSE);
if (!MATECOMPONENT_PLUG (widget)->priv->forward_events || !GTK_WIDGET_TOPLEVEL (widget))
return FALSE;
#if defined (GDK_WINDOWING_X11)
if (event->type == GDK_BUTTON_PRESS) {
xevent.xbutton.type = ButtonPress;
/* X does an automatic pointer grab on button press
* if we have both button press and release events
* selected.
* We don't want to hog the pointer on our parent.
*/
gdk_display_pointer_ungrab
(gtk_widget_get_display (widget),
GDK_CURRENT_TIME);
} else
xevent.xbutton.type = ButtonRelease;
xevent.xbutton.display = GDK_WINDOW_XDISPLAY (widget->window);
xevent.xbutton.window = GDK_WINDOW_XWINDOW (GTK_PLUG (widget)->socket_window);
xevent.xbutton.root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window
(gdk_drawable_get_screen (widget->window)));
/*
* FIXME: the following might cause
* big problems for non-GTK apps
*/
xevent.xbutton.x = 0;
xevent.xbutton.y = 0;
xevent.xbutton.x_root = 0;
xevent.xbutton.y_root = 0;
xevent.xbutton.state = event->state;
xevent.xbutton.button = event->button;
xevent.xbutton.same_screen = TRUE; /* FIXME ? */
gdk_error_trap_push ();
XSendEvent (GDK_WINDOW_XDISPLAY (widget->window),
GDK_WINDOW_XWINDOW (GTK_PLUG (widget)->socket_window),
False, NoEventMask, &xevent);
gdk_flush ();
gdk_error_trap_pop ();
#elif defined (GDK_WINDOWING_WIN32)
/* FIXME: Need to do something? */
#endif
return TRUE;
}
示例3: plug_construct
static VALUE
plug_construct(VALUE self, VALUE socket_id)
{
#ifdef GDK_NATIVE_WINDOW_POINTER
gtk_plug_construct(GTK_PLUG(RVAL2GOBJ(self)), GUINT_TO_POINTER(NUM2ULONG(socket_id)));
#else
gtk_plug_construct(GTK_PLUG(RVAL2GOBJ(self)), (guint32)NUM2UINT(socket_id));
#endif
return self;
}
示例4: egg_tray_icon_new_for_xscreen
EggTrayIcon *
egg_tray_icon_new_for_xscreen (Screen *xscreen, const char *name)
{
EggTrayIcon *icon;
char buffer[256];
GdkWindow *root_window;
g_return_val_if_fail (xscreen != NULL, NULL);
icon = g_object_new (EGG_TYPE_TRAY_ICON, NULL);
gtk_window_set_title (GTK_WINDOW (icon), name);
#if HAVE_GTK_MULTIHEAD
/* FIXME: this code does not compile, screen is undefined. Now try
* getting the GdkScreen from xscreen (:. Dunno how to solve this
* (there is prolly some easy way I cant think of right now)
*/
gtk_plug_construct_for_display (GTK_PLUG (icon),
gdk_screen_get_display (screen), 0);
#else
gtk_plug_construct (GTK_PLUG (icon), 0);
#endif
gtk_widget_realize (GTK_WIDGET (icon));
/* Now see if there's a manager window around */
g_snprintf (buffer, sizeof (buffer),
"_NET_SYSTEM_TRAY_S%d",
XScreenNumberOfScreen (xscreen));
icon->selection_atom = XInternAtom (DisplayOfScreen (xscreen),
buffer, False);
icon->manager_atom = XInternAtom (DisplayOfScreen (xscreen),
"MANAGER", False);
icon->system_tray_opcode_atom = XInternAtom (DisplayOfScreen (xscreen),
"_NET_SYSTEM_TRAY_OPCODE", False);
egg_tray_icon_update_manager_window (icon);
#if HAVE_GTK_MULTIHEAD
root_window = gdk_screen_get_root_window (gtk_widget_get_screen (screen));
#else
root_window = gdk_window_lookup (gdk_x11_get_default_root_xwindow ());
#endif
/* Add a root window filter so that we get changes on MANAGER */
gdk_window_add_filter (root_window,
egg_tray_icon_manager_filter, icon);
return icon;
}
示例5: totem_interface_set_transient_for
void
totem_interface_set_transient_for (GtkWindow *window, GtkWindow *parent)
{
#ifdef GDK_WINDOWING_X11
GdkDisplay *display;
display = gdk_display_get_default ();
if (GDK_IS_X11_DISPLAY (display) &&
GTK_IS_PLUG (parent)) {
GdkWindow *toplevel;
gtk_widget_realize (GTK_WIDGET (window));
toplevel = totem_gtk_plug_get_toplevel (GTK_PLUG (parent));
if (toplevel != NULL) {
gdk_window_set_transient_for
(gtk_widget_get_window (GTK_WIDGET (window)), toplevel);
g_object_unref (toplevel);
}
return;
}
#endif /* GDK_WINDOWING_X11 */
gtk_window_set_transient_for (GTK_WINDOW (window),
GTK_WINDOW (parent));
}
示例6: _calendar_embedded
static int _calendar_embedded(void)
{
GtkWidget * window;
GtkWidget * widget;
Calendar * calendar;
unsigned long id;
window = gtk_plug_new(0);
gtk_widget_realize(window);
g_signal_connect_swapped(window, "embedded", G_CALLBACK(
_embedded_on_embedded), window);
if((calendar = calendar_new()) == NULL)
{
gtk_widget_destroy(window);
return -1;
}
widget = calendar_get_widget(calendar);
gtk_container_add(GTK_CONTAINER(window), widget);
id = gtk_plug_get_id(GTK_PLUG(window));
printf("%lu\n", id);
fclose(stdout);
gtk_main();
calendar_delete(calendar);
gtk_widget_destroy(window);
return 0;
}
示例7: impl_MateComponent_Control_getWindowId
static CORBA_char *
impl_MateComponent_Control_getWindowId (PortableServer_Servant servant,
const CORBA_char *cookie,
CORBA_Environment *ev)
{
guint32 x11_id;
MateComponentControl *control = MATECOMPONENT_CONTROL (
matecomponent_object_from_servant (servant));
GdkScreen *gdkscreen;
int screen_num;
if (!control->priv->plug)
create_plug (control);
g_assert (control->priv->plug != NULL);
screen_num = parse_cookie (cookie);
if (screen_num != -1)
gdkscreen = gdk_display_get_screen (
gdk_display_get_default (), screen_num);
else
gdkscreen = gdk_screen_get_default ();
gtk_window_set_screen (GTK_WINDOW (control->priv->plug), gdkscreen);
gtk_widget_show (control->priv->plug);
x11_id = gtk_plug_get_id (GTK_PLUG (control->priv->plug));
dbgprintf ("plug id %u\n", x11_id);
return matecomponent_control_window_id_from_x11 (x11_id);
}
示例8: egg_tray_icon_send_dock_request
static void egg_tray_icon_send_dock_request (EggTrayIcon *icon) {
egg_tray_icon_send_manager_message (icon,
SYSTEM_TRAY_REQUEST_DOCK,
icon->manager_window,
gtk_plug_get_id (GTK_PLUG (icon)),
0, 0);
}
示例9: realize_cb
static void
realize_cb (GtkWidget *socket, gpointer user_data)
{
GtkWidget *plug, *w;
g_warning ("Realize");
plug = gtk_plug_new (0);
w = gtk_button_new_with_label ("Baa");
gtk_widget_show_all (w);
gtk_widget_show (plug);
gtk_container_add (GTK_CONTAINER (plug), w);
GTK_PLUG (plug)->socket_window = GTK_WIDGET (socket)->window;
gtk_socket_add_id (GTK_SOCKET (socket),
gtk_plug_get_id (GTK_PLUG (plug)));
gdk_window_show (GTK_WIDGET (plug)->window);
}
示例10: matecomponent_plug_construct_full
/**
* matecomponent_plug_construct_full:
* @plug: The #MateComponentPlug.
* @socket_id: the XID of the socket's window.
*
* Finish the creation of a #MateComponentPlug widget. This function
* will generally only be used by classes deriving
* from #MateComponentPlug.
*/
void
matecomponent_plug_construct_full (MateComponentPlug *plug,
GdkDisplay *display,
guint32 socket_id)
{
gtk_plug_construct_for_display
(GTK_PLUG (plug), display, socket_id);
}
示例11: plug_get_id
static VALUE
plug_get_id(VALUE self)
{
GdkNativeWindow id = gtk_plug_get_id(GTK_PLUG(RVAL2GOBJ(self)));
#ifdef GDK_NATIVE_WINDOW_POINTER
return UINT2NUM(GPOINTER_TO_UINT(id));
#else
return UINT2NUM(id);
#endif
}
示例12: egg_tray_icon_cancel_message
void egg_tray_icon_cancel_message (EggTrayIcon *icon,
guint id)
{
g_return_if_fail (EGG_IS_TRAY_ICON (icon));
g_return_if_fail (id > 0);
egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE,
(Window)gtk_plug_get_id (GTK_PLUG (icon)),
id, 0, 0);
}
示例13: ASSERT
void NetscapePluginX11::visibilityDidChange()
{
ASSERT(m_plugin.isWindowed());
uint64_t windowID = 0;
#if PLATFORM(GTK)
windowID = static_cast<uint64_t>(GDK_WINDOW_XID(gtk_plug_get_socket_window(GTK_PLUG(m_platformPluginWidget))));
#endif
m_plugin.controller()->windowedPluginVisibilityDidChange(m_plugin.isVisible(), windowID);
m_plugin.controller()->windowedPluginGeometryDidChange(m_plugin.frameRectInWindowCoordinates(), m_plugin.clipRect(), windowID);
}
示例14: bacon_video_widget_gst_get_toplevel
static Window
bacon_video_widget_gst_get_toplevel (GtkWidget *widget)
{
GtkWidget *parent;
parent = gtk_widget_get_toplevel (GTK_WIDGET (widget));
if (parent == NULL)
return 0;
if (GTK_IS_PLUG (parent))
return bacon_video_widget_gtk_plug_get_toplevel (GTK_PLUG (parent));
else
return GDK_WINDOW_XID(gtk_widget_get_window (parent));
}
示例15: egg_tray_icon_new_for_xscreen
EggTrayIcon *
egg_tray_icon_new_for_xscreen (Screen *xscreen, const char *name)
{
EggTrayIcon *icon;
char buffer[256];
GdkWindow *root_window;
GdkDisplay *display;
GdkScreen *screen;
g_return_val_if_fail (xscreen != NULL, NULL);
icon = g_object_new (EGG_TYPE_TRAY_ICON, NULL);
gtk_window_set_title (GTK_WINDOW (icon), name);
display = gdk_x11_lookup_xdisplay (DisplayOfScreen (xscreen));
screen = gdk_display_get_screen (display, XScreenNumberOfScreen (xscreen));
gtk_plug_construct_for_display (GTK_PLUG (icon),
display, 0);
gtk_window_set_screen (GTK_WINDOW (icon), screen);
gtk_widget_realize (GTK_WIDGET (icon));
/* Now see if there's a manager window around */
g_snprintf (buffer, sizeof (buffer),
"_NET_SYSTEM_TRAY_S%d",
XScreenNumberOfScreen (xscreen));
icon->selection_atom = XInternAtom (DisplayOfScreen (xscreen),
buffer, False);
icon->manager_atom = XInternAtom (DisplayOfScreen (xscreen),
"MANAGER", False);
icon->system_tray_opcode_atom = XInternAtom (DisplayOfScreen (xscreen),
"_NET_SYSTEM_TRAY_OPCODE", False);
egg_tray_icon_update_manager_window (icon);
root_window = gdk_screen_get_root_window (gtk_widget_get_screen (GTK_WIDGET (icon)));
/* Add a root window filter so that we get changes on MANAGER */
gdk_window_add_filter (root_window,
egg_tray_icon_manager_filter, icon);
return icon;
}