コード例 #1
0
ファイル: gicon.c プロジェクト: S010/test
void
on_winid_get_clicked(GtkWidget *widget, gpointer data)
{
	GtkEntry *entry = data;
	char buf[64];
	size_t bufsize = sizeof(buf);
	guint32 id;

	id = gtk_status_icon_get_x11_window_id(status_icon);
	snprintf(buf, bufsize, "%lu", (unsigned long) id);
	gtk_entry_set_text(entry, buf);
}
コード例 #2
0
ファイル: gtrayicon.cpp プロジェクト: ramonelalto/gambas
void gTrayIcon::setVisible(bool vl)
{
	if (vl)
	{
		if (!plug)
		{
			_loopLevel = gApplication::loopLevel() + 1;
			
			plug = gtk_status_icon_new();

			updatePicture();
			updateTooltip();

			#ifdef GDK_WINDOWING_X11
			// Needed, otherwise the icon does not appear in Gnome or XFCE notification area!
			XSizeHints hints;
			hints.flags = PMinSize;
			hints.min_width = _iconw;
			hints.min_height = _iconh;
			XSetWMNormalHints(gdk_x11_display_get_xdisplay(gdk_display_get_default()), gtk_status_icon_get_x11_window_id(plug), &hints);
			#endif

			gtk_status_icon_set_visible(plug, TRUE);

			//g_signal_connect(G_OBJECT(plug), "destroy", G_CALLBACK(cb_destroy),(gpointer)this);
			g_signal_connect(G_OBJECT(plug), "button-press-event", G_CALLBACK(cb_button_press), (gpointer)this);
			g_signal_connect(G_OBJECT(plug), "button-release-event", G_CALLBACK(cb_button_release),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug), "activate", G_CALLBACK(cb_activate),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"focus-in-event",G_CALLBACK(tray_focus_In),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"focus-out-event",G_CALLBACK(tray_focus_Out),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"enter-notify-event",G_CALLBACK(tray_enterleave),(gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"leave-notify-event",G_CALLBACK(tray_enterleave),(gpointer)this);
			g_signal_connect(G_OBJECT(plug), "popup-menu", G_CALLBACK(cb_menu), (gpointer)this);
			g_signal_connect(G_OBJECT(plug), "scroll-event", G_CALLBACK(cb_scroll), (gpointer)this);
			//g_signal_connect(G_OBJECT(plug),"expose-event", G_CALLBACK(cb_expose), (gpointer)this);
			
			_visible_count++;

			usleep(10000); // BUG: Embedding too fast sometimes fails with GTK+
		}
	}
	else
	{
		if (plug)
		{
			GB.Post((void (*)())hide_icon, (intptr_t)plug);
			plug = NULL;
			_visible_count--;
		}
	}
}