本文整理汇总了C++中GDK_WINDOW_XDISPLAY函数的典型用法代码示例。如果您正苦于以下问题:C++ GDK_WINDOW_XDISPLAY函数的具体用法?C++ GDK_WINDOW_XDISPLAY怎么用?C++ GDK_WINDOW_XDISPLAY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GDK_WINDOW_XDISPLAY函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: tilda_window_set_active
/* This function will make sure that tilda window becomes active (gains
* the focus) when it is called.
*
* This has to be the worst possible way of making this work, but it was the
* only way to get metacity to play nicely. All the other WM's are so nice,
* why oh why does metacity hate us so?
*/
void tilda_window_set_active (tilda_window *tw)
{
DEBUG_FUNCTION ("tilda_window_set_active");
DEBUG_ASSERT (tw != NULL);
Display *x11_display = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (tw->window) );
Window x11_window = GDK_WINDOW_XID (gtk_widget_get_window (tw->window) );
Window x11_root_window = GDK_WINDOW_XID ( gtk_widget_get_root_window (tw->window) );
GdkScreen *screen = gtk_widget_get_screen (tw->window);
XEvent event;
long mask = SubstructureRedirectMask | SubstructureNotifyMask;
gtk_window_move (GTK_WINDOW(tw->window), config_getint ("x_pos"), config_getint ("y_pos"));
if (gdk_x11_screen_supports_net_wm_hint (screen,
gdk_atom_intern_static_string ("_NET_ACTIVE_WINDOW")))
{
guint32 timestamp = gtk_get_current_event_time ();
if (timestamp == 0) {
timestamp = gdk_x11_get_server_time(gtk_widget_get_root_window (tw->window));
}
event.xclient.type = ClientMessage;
event.xclient.serial = 0;
event.xclient.send_event = True;
event.xclient.display = x11_display;
event.xclient.window = x11_window;
event.xclient.message_type = gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW");
event.xclient.format = 32;
event.xclient.data.l[0] = 2; /* pager */
event.xclient.data.l[1] = timestamp; /* timestamp */
event.xclient.data.l[2] = 0;
event.xclient.data.l[3] = 0;
event.xclient.data.l[4] = 0;
XSendEvent (x11_display, x11_root_window, False, mask, &event);
}
else
{
/* The WM doesn't support the EWMH standards. We'll print a warning and
* try this, though it probably won't work... */
g_printerr (_("WARNING: Window manager (%s) does not support EWMH hints\n"),
gdk_x11_screen_get_window_manager_name (screen));
XRaiseWindow (x11_display, x11_window);
}
}
开发者ID:acidtonic,项目名称:tilda,代码行数:52,代码来源:key_grabber.c
示例2: turn
gboolean
turn (gpointer user_data)
{
static double place = 0.0;
place++;
while (place>360.0)
{
place -= 360.0;
}
XMoveWindow (GDK_WINDOW_XDISPLAY (window->window),
GDK_WINDOW_XID (window->window),
100+100*sin(place*(M_PI/180)),
100+100*cos(place*(M_PI/180)));
return TRUE;
}
开发者ID:gpoudrel,项目名称:xzibit,代码行数:18,代码来源:floater.c
示例3: draw_background
static void
draw_background (GnomeBGCrossfade *fade)
{
if (gdk_window_get_window_type (fade->priv->window) == GDK_WINDOW_ROOT) {
XClearArea (GDK_WINDOW_XDISPLAY (fade->priv->window),
GDK_WINDOW_XID (fade->priv->window),
0, 0,
gdk_window_get_width (fade->priv->window),
gdk_window_get_height (fade->priv->window),
False);
send_root_property_change_notification (fade);
gdk_flush ();
} else {
gdk_window_invalidate_rect (fade->priv->window, NULL, FALSE);
gdk_window_process_updates (fade->priv->window, FALSE);
}
}
开发者ID:1dot75cm,项目名称:gnome-desktop,代码行数:19,代码来源:gnome-bg-crossfade.c
示例4: have_extension
/*
* Need to get GdkWindow after invoke gtk_widget_show() and gtk_main()
*/
static gboolean
have_extension (InputPadGtkWindow *window)
{
int opcode = 0;
int event = 0;
int error = 0;
g_return_val_if_fail (window != NULL &&
INPUT_PAD_IS_GTK_WINDOW (window), FALSE);
if (!XQueryExtension (GDK_WINDOW_XDISPLAY (gtk_widget_get_window (GTK_WIDGET (window))),
"XTEST", &opcode, &event, &error)) {
g_warning ("Could not find XTEST module. Maybe you did not install "
"libXtst library.\n"
"%% xdpyinfo | grep XTEST");
return FALSE;
}
return TRUE;
}
开发者ID:pkg-ime,项目名称:input-pad,代码行数:22,代码来源:xtest-gdk.c
示例5: input_pad_xkb_init
static gboolean
input_pad_xkb_init (InputPadGtkWindow *window)
{
static gboolean retval = FALSE;
Display *xdisplay = GDK_WINDOW_XDISPLAY (gtk_widget_get_window (GTK_WIDGET (window)));
if (retval) {
return retval;
}
if (!XkbQueryExtension (xdisplay, NULL, NULL, NULL, NULL, NULL)) {
g_warning ("Could not init XKB");
return FALSE;
}
XkbInitAtoms (NULL);
retval = TRUE;
return TRUE;
}
开发者ID:fujiwarat,项目名称:input-pad-backup,代码行数:19,代码来源:geometry-gdk.c
示例6: wxControl
////////////////////////////////////////////////////////////
/// Construct the wxSFMLCanvas
////////////////////////////////////////////////////////////
wxSFMLCanvas::wxSFMLCanvas(wxWindow* Parent, wxWindowID Id, const wxPoint& Position, const wxSize& Size, long Style) :
wxControl(Parent, Id, Position, Size, Style)
{
#ifdef __WXGTK__
// GTK implementation requires to go deeper to find the low-level X11 identifier of the widget
gtk_widget_realize(m_wxwindow);
gtk_widget_set_double_buffered(m_wxwindow, false);
GdkWindow* Win = GTK_PIZZA(m_wxwindow)->bin_window;
XFlush(GDK_WINDOW_XDISPLAY(Win));
sf::RenderWindow::Create(GDK_WINDOW_XWINDOW(Win));
#else
// Tested under Windows XP only (should work with X11 and other Windows versions - no idea about MacOS)
sf::RenderWindow::create(GetHandle());
#endif
}
开发者ID:pilasvacias,项目名称:pilasPaint,代码行数:22,代码来源:wxSFMLCanvas.cpp
示例7: shortcut_edited_cb
static void
shortcut_edited_cb(GtkCellRendererText *cell,
const char *path_string,
guint keyval,
EggVirtualModifierType mask,
guint keycode,
gpointer data)
{
Vnkb *vnkb = (Vnkb*)data;
GtkTreeModel *model = GTK_TREE_MODEL(vnkb->store);
GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
GtkTreeIter iter;
KeyEntry *key_entry, tmp_key;
GError *err = NULL;
char *str;
GdkWindow *gdkroot = gdk_get_default_root_window();
Display *display = GDK_WINDOW_XDISPLAY(gdkroot);
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter,
1, &key_entry,
-1);
/* sanity check */
if (key_entry == NULL) {
gtk_tree_path_free (path);
return;
}
tmp_key.keyval = keyval;
tmp_key.keycode = keycode;
tmp_key.mask = mask;
*key_entry = tmp_key;
gtk_tree_model_row_changed (model, path, &iter);
gtk_tree_path_free (path);
vnkb->xvnkb->hotkey.state = mask;
vnkb->xvnkb->hotkey.sym = XKeycodeToKeysym(display,keycode,0);
if (vnkb->xvnkb->hotkey.state & VK_SHIFT)
vnkb->xvnkb->hotkey.sym = toupper(vnkb->xvnkb->hotkey.sym);
vnkb_xvnkb_update_switchkey(vnkb);
}
开发者ID:BackupTheBerlios,项目名称:vnkb-applet-svn,代码行数:43,代码来源:pref.c
示例8: wxControl
/* OGLCanvas::OGLCanvas
* OGLCanvas class constructor, SFML implementation
*******************************************************************/
OGLCanvas::OGLCanvas(wxWindow* parent, int id, bool handle_timer)
: wxControl(parent, id, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxWANTS_CHARS), timer(this) {
init_done = false;
last_time = theApp->runTimer();
if (handle_timer)
timer.Start(100);
// Code taken from SFML wxWidgets integration example
sf::WindowHandle handle;
#ifdef __WXGTK__
// GTK implementation requires to go deeper to find the
// low-level X11 identifier of the widget
gtk_widget_realize(m_wxwindow);
gtk_widget_set_double_buffered(m_wxwindow, false);
GdkWindow* Win = gtk_widget_get_window(m_wxwindow);
XFlush(GDK_WINDOW_XDISPLAY(Win));
//sf::RenderWindow::Create(GDK_WINDOW_XWINDOW(Win));
handle = GDK_WINDOW_XWINDOW(Win);
#else
handle = GetHandle();
#endif
#if SFML_VERSION_MAJOR < 2
sf::RenderWindow::Create(handle);
#else
// Context settings
sf::ContextSettings settings;
settings.depthBits = 32;
settings.stencilBits = 8;
sf::RenderWindow::create(handle, settings);
#endif
// Bind events
Bind(wxEVT_PAINT, &OGLCanvas::onPaint, this);
Bind(wxEVT_ERASE_BACKGROUND, &OGLCanvas::onEraseBackground, this);
//Bind(wxEVT_IDLE, &OGLCanvas::onIdle, this);
if (handle_timer)
Bind(wxEVT_TIMER, &OGLCanvas::onTimer, this);
}
开发者ID:doomtech,项目名称:slade,代码行数:44,代码来源:OGLCanvas.cpp
示例9: na_tray_child_draw
/* The plug window should completely occupy the area of the child, so we won't
* get a draw event. But in case we do (the plug unmaps itself, say), this
* draw handler draws with real or fake transparency.
*/
static gboolean
na_tray_child_draw (GtkWidget *widget,
cairo_t *cr)
{
NaTrayChild *child = NA_TRAY_CHILD (widget);
if (na_tray_child_has_alpha (child))
{
/* Clear to transparent */
cairo_set_source_rgba (cr, 0, 0, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
}
else if (child->parent_relative_bg)
{
GdkWindow *window;
cairo_surface_t *target;
GdkRectangle clip_rect;
window = gtk_widget_get_window (widget);
target = cairo_get_group_target (cr);
gdk_cairo_get_clip_rectangle (cr, &clip_rect);
/* Clear to parent-relative pixmap
* We need to use direct X access here because GDK doesn't know about
* the parent relative pixmap. */
cairo_surface_flush (target);
XClearArea (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
clip_rect.x, clip_rect.y,
clip_rect.width, clip_rect.height,
False);
cairo_surface_mark_dirty_rectangle (target,
clip_rect.x, clip_rect.y,
clip_rect.width, clip_rect.height);
}
return FALSE;
}
开发者ID:SESDE,项目名称:SESDE,代码行数:45,代码来源:na-tray-child.c
示例10: gtk_widget_queue_draw_area
void MdispGtkView::X11Annotations( bool on )
{
m_isX11AnnotationsEnabled = on;
if(on)
{
gtk_widget_queue_draw_area(m_window,0,0,1,1);
}
// make sur the window is mapped
else if(m_window->window)
{
XEvent ev;
ev.type = Expose;
ev.xexpose.window = GDK_WINDOW_XID(m_window->window);
ev.xexpose.x = 0;
ev.xexpose.y = 0;
ev.xexpose.width = m_window->allocation.width;
ev.xexpose.height = m_window->allocation.height;
XSendEvent(GDK_WINDOW_XDISPLAY(m_window->window),GDK_WINDOW_XID(m_window->window), true, ExposureMask, &ev);
}
}
开发者ID:DayStarEngineering,项目名称:CDH,代码行数:21,代码来源:mdispgtkview.cpp
示例11: panel_warp_pointer
void
panel_warp_pointer (GdkWindow *gdk_window,
int x,
int y)
{
Display *display;
Window window;
g_return_if_fail (GDK_IS_WINDOW (gdk_window));
display = GDK_WINDOW_XDISPLAY (gdk_window);
window = GDK_WINDOW_XID (gdk_window);
gdk_error_trap_push ();
XWarpPointer (display, None, window, 0, 0, 0, 0, x, y);
#if GTK_CHECK_VERSION (3, 0, 0)
gdk_error_trap_pop_ignored ();
#else
gdk_error_trap_pop ();
#endif
}
开发者ID:City-busz,项目名称:mate-panel,代码行数:21,代码来源:panel-xutils.c
示例12: wxControl
////////////////////////////////////////////////////////////
/// Construct the wxSFMLCanvas
////////////////////////////////////////////////////////////
wxSFMLCanvas::wxSFMLCanvas(wxWindow *Parent,
wxWindowID Id,
const wxPoint &Position,
const wxSize &Size,
long Style)
: wxControl(Parent, Id, Position, Size, Style) {
#ifdef __WXGTK__
// GTK implementation requires to go deeper to find the low-level X11
// identifier of the widget
gtk_widget_realize(m_wxwindow);
gtk_widget_set_double_buffered(m_wxwindow, false);
GtkWidget *privHandle = m_wxwindow;
wxPizza *pizza = WX_PIZZA(privHandle);
GtkWidget *widget = GTK_WIDGET(pizza);
// Get the internal gtk window...
#if GTK_CHECK_VERSION(3, 0, 0)
GdkWindow *win = gtk_widget_get_window(widget);
#else
GdkWindow *win = widget->window;
#endif
XFlush(GDK_WINDOW_XDISPLAY(win));
//...and pass it to the sf::RenderWindow.
#if GTK_CHECK_VERSION(3, 0, 0)
sf::RenderWindow::create(GDK_WINDOW_XID(win));
#else
sf::RenderWindow::create(GDK_WINDOW_XWINDOW(win));
#endif
#else
// Tested under Windows XP only (should work with X11 and other Windows
// versions - no idea about MacOS)
sf::RenderWindow::create(static_cast<sf::WindowHandle>(GetHandle()));
#endif
}
开发者ID:Lizard-13,项目名称:GD,代码行数:43,代码来源:wxSFMLCanvas.cpp
示例13: GTK_CHECK_VERSION
bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha)
{
if (m_widget == NULL)
return false;
#if GTK_CHECK_VERSION(2,12,0)
#ifndef __WXGTK3__
if (gtk_check_version(2,12,0) == NULL)
#endif
{
gtk_window_set_opacity(GTK_WINDOW(m_widget), alpha / 255.0);
return true;
}
#endif // GTK_CHECK_VERSION(2,12,0)
#ifndef __WXGTK3__
#ifdef GDK_WINDOWING_X11
GdkWindow* window = gtk_widget_get_window(m_widget);
if (window == NULL)
return false;
Display* dpy = GDK_WINDOW_XDISPLAY(window);
Window win = GDK_WINDOW_XID(window);
if (alpha == 0xff)
XDeleteProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False));
else
{
long opacity = alpha * 0x1010101L;
XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False),
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *) &opacity, 1L);
}
XSync(dpy, False);
return true;
#else // !GDK_WINDOWING_X11
return false;
#endif // GDK_WINDOWING_X11 / !GDK_WINDOWING_X11
#endif // !__WXGTK3__
}
开发者ID:raydtang,项目名称:wxWidgets,代码行数:38,代码来源:toplevel.cpp
示例14: egg_tray_manager_set_orientation_property
static void
egg_tray_manager_set_orientation_property (EggTrayManager *manager)
{
#ifdef GDK_WINDOWING_X11
gulong data[1];
if (!manager->invisible || !manager->invisible->window)
return;
g_assert (manager->orientation_atom != None);
data[0] = manager->orientation == GTK_ORIENTATION_HORIZONTAL ?
SYSTEM_TRAY_ORIENTATION_HORZ :
SYSTEM_TRAY_ORIENTATION_VERT;
XChangeProperty (GDK_WINDOW_XDISPLAY (manager->invisible->window),
GDK_WINDOW_XWINDOW (manager->invisible->window),
manager->orientation_atom,
XA_CARDINAL, 32,
PropModeReplace,
(guchar *) &data, 1);
#endif
}
开发者ID:micove,项目名称:awn-extras,代码行数:23,代码来源:eggtraymanager.c
示例15: EnsureInit
// this function will make sure that everything has been initialized.
nsresult
nsScreenManagerGtk :: EnsureInit()
{
if (mCachedScreenArray.Count() > 0)
return NS_OK;
mRootWindow = gdk_get_default_root_window();
g_object_ref(mRootWindow);
// GDK_STRUCTURE_MASK ==> StructureNotifyMask, for ConfigureNotify
// GDK_PROPERTY_CHANGE_MASK ==> PropertyChangeMask, for PropertyNotify
gdk_window_set_events(mRootWindow,
GdkEventMask(gdk_window_get_events(mRootWindow) |
GDK_STRUCTURE_MASK |
GDK_PROPERTY_CHANGE_MASK));
gdk_window_add_filter(mRootWindow, root_window_event_filter, this);
#ifdef MOZ_X11
mNetWorkareaAtom =
XInternAtom(GDK_WINDOW_XDISPLAY(mRootWindow), "_NET_WORKAREA", False);
#endif
return Init();
}
开发者ID:at13,项目名称:mozilla-central,代码行数:24,代码来源:nsScreenManagerGtk.cpp
示例16: hildon_remote_texture_send_message
/**
* hildon_remote_texture_send_message:
* @self: A #HildonRemoteTexture
* @message_type: Message id for the remote texture message.
* @l0: 1st remote texture message parameter.
* @l1: 2nd remote texture message parameter.
* @l2: 3rd remote texture message parameter.
* @l3: 4th remote texture message parameter.
* @l4: 5th remote texture message parameter.
*
* Sends an X11 ClientMessage event to the window manager with
* the specified parameters -- id (@message_type) and data (@l0,
* @l1, @l2, @l3, @l4).
*
* This is an internal utility function that application will
* not need to call directly.
*
* Since: 2.2
**/
void
hildon_remote_texture_send_message (HildonRemoteTexture *self,
guint32 message_type,
guint32 l0,
guint32 l1,
guint32 l2,
guint32 l3,
guint32 l4)
{
GtkWidget *widget = GTK_WIDGET (self);
Display *display = GDK_WINDOW_XDISPLAY (widget->window);
Window window = GDK_WINDOW_XID (widget->window);
XEvent event = { 0 };
event.xclient.type = ClientMessage;
event.xclient.window = window;
event.xclient.message_type = (Atom)message_type;
event.xclient.format = 32;
event.xclient.data.l[0] = l0;
event.xclient.data.l[1] = l1;
event.xclient.data.l[2] = l2;
event.xclient.data.l[3] = l3;
event.xclient.data.l[4] = l4;
#if 0
g_debug ("%lu (%lu %lu %lu %lu %lu) -> %lu\n",
message_type,
l0, l1, l2, l3, l4,
window);
#endif
XSendEvent (display, window, True,
StructureNotifyMask,
(XEvent *)&event);
}
开发者ID:archlinuxarm-n900,项目名称:libhildon,代码行数:55,代码来源:hildon-remote-texture.c
示例17: gtk_widget_realize
void OGLCanvas::createSFML()
{
#ifdef USE_SFML_RENDERWINDOW
// Code taken from SFML wxWidgets integration example
sf::WindowHandle handle;
#ifdef __WXGTK__
// GTK implementation requires to go deeper to find the
// low-level X11 identifier of the widget
gtk_widget_realize(m_wxwindow);
gtk_widget_set_double_buffered(m_wxwindow, false);
GdkWindow* Win = gtk_widget_get_window(m_wxwindow);
XFlush(GDK_WINDOW_XDISPLAY(Win));
// sf::RenderWindow::Create(GDK_WINDOW_XWINDOW(Win));
handle = GDK_WINDOW_XWINDOW(Win);
#else
handle = GetHandle();
#endif
// Context settings
sf::ContextSettings settings;
settings.depthBits = 24;
settings.stencilBits = 8;
sf::RenderWindow::create(handle, settings);
#endif
}
开发者ID:SteelTitanium,项目名称:SLADE,代码行数:24,代码来源:OGLCanvas.cpp
示例18: _gtk_xembed_send_message
/**
* _gtk_xembed_send_message:
* @recipient: (allow-none): window to which to send the window, or %NULL
* in which case nothing will be sent
* @message: type of message
* @detail: detail field of message
* @data1: data1 field of message
* @data2: data2 field of message
*
* Sends a generic XEMBED message to a particular window.
**/
void
_gtk_xembed_send_message (GdkWindow *recipient,
XEmbedMessageType message,
glong detail,
glong data1,
glong data2)
{
GdkDisplay *display;
XClientMessageEvent xclient;
if (!recipient)
return;
g_return_if_fail (GDK_IS_WINDOW (recipient));
display = gdk_window_get_display (recipient);
GTK_NOTE (PLUGSOCKET,
g_message ("Sending %s", _gtk_xembed_message_name (message)));
memset (&xclient, 0, sizeof (xclient));
xclient.window = GDK_WINDOW_XID (recipient);
xclient.type = ClientMessage;
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_XEMBED");
xclient.format = 32;
xclient.data.l[0] = gtk_xembed_get_time ();
xclient.data.l[1] = message;
xclient.data.l[2] = detail;
xclient.data.l[3] = data1;
xclient.data.l[4] = data2;
gdk_x11_display_error_trap_push (display);
XSendEvent (GDK_WINDOW_XDISPLAY(recipient),
GDK_WINDOW_XID (recipient),
False, NoEventMask, (XEvent *)&xclient);
gdk_x11_display_error_trap_pop_ignored (display);
}
开发者ID:endlessm,项目名称:gtk,代码行数:47,代码来源:gtkxembed.c
示例19: GDK_WINDOW_XDISPLAY
bool wxTopLevelWindowGTK::SetTransparent(wxByte alpha)
{
if (!m_widget || !m_widget->window)
return false;
Display* dpy = GDK_WINDOW_XDISPLAY (m_widget->window);
// We need to get the X Window that has the root window as the immediate parent
// and m_widget->window as a child. This should be the X Window that the WM manages and
// from which the opacity property is checked from.
Window win = wxGetTopmostWindowX11(dpy, GDK_WINDOW_XID (m_widget->window));
// Using pure Xlib to not have a GTK version check mess due to gtk2.0 not having GdkDisplay
if (alpha == 0xff)
XDeleteProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False));
else
{
long opacity = alpha * 0x1010101L;
XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False),
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *) &opacity, 1L);
}
XSync(dpy, False);
return true;
}
开发者ID:EdgarTx,项目名称:wx,代码行数:24,代码来源:toplevel.cpp
示例20: meta_window_menu_new
LOCAL_SYMBOL MetaWindowMenu*
meta_window_menu_new (MetaFrames *frames,
MetaMenuOp ops,
MetaMenuOp insensitive,
Window client_xwindow,
unsigned long active_workspace,
int n_workspaces,
MetaWindowMenuFunc func,
gpointer data)
{
int i;
MetaWindowMenu *menu;
/* FIXME: Modifications to 'ops' should happen in meta_window_show_menu */
if (n_workspaces < 2)
ops &= ~(META_MENU_OP_STICK | META_MENU_OP_UNSTICK | META_MENU_OP_WORKSPACES);
menu = g_new (MetaWindowMenu, 1);
menu->frames = frames;
menu->client_xwindow = client_xwindow;
menu->func = func;
menu->data = data;
menu->ops = ops;
menu->insensitive = insensitive;
menu->menu = gtk_menu_new ();
gtk_menu_set_screen (GTK_MENU (menu->menu),
gtk_widget_get_screen (GTK_WIDGET (frames)));
for (i = 0; i < (int) G_N_ELEMENTS (menuitems); i++)
{
MenuItem menuitem = menuitems[i];
if (ops & menuitem.op || menuitem.op == 0)
{
GtkWidget *mi;
MenuData *md;
unsigned int key;
MetaVirtualModifier mods;
mi = menu_item_new (&menuitem, -1);
/* Set the activeness of radiobuttons. */
switch (menuitem.op)
{
case META_MENU_OP_STICK:
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi),
active_workspace == 0xFFFFFFFF);
break;
case META_MENU_OP_UNSTICK:
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (mi),
active_workspace != 0xFFFFFFFF);
break;
default:
break;
}
if (menuitem.type == MENU_ITEM_WORKSPACE_LIST)
{
if (ops & META_MENU_OP_WORKSPACES)
{
Display *display;
Window xroot;
GdkScreen *screen;
GdkWindow *window;
GtkWidget *submenu;
int j;
MenuItem to_another_workspace = {
0, MENU_ITEM_NORMAL,
NULL, FALSE,
N_("Move to Another _Workspace")
};
meta_verbose ("Creating %d-workspace menu current space %lu\n",
n_workspaces, active_workspace);
window = gtk_widget_get_window (GTK_WIDGET (frames));
display = GDK_WINDOW_XDISPLAY (window);
screen = gdk_window_get_screen (window);
xroot = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
submenu = gtk_menu_new ();
g_assert (mi==NULL);
mi = menu_item_new (&to_another_workspace, -1);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (mi), submenu);
for (j = 0; j < n_workspaces; j++)
{
char *label;
MenuData *md;
unsigned int key;
MetaVirtualModifier mods;
MenuItem moveitem;
GtkWidget *submi;
meta_core_get_menu_accelerator (META_MENU_OP_WORKSPACES,
j + 1,
//.........这里部分代码省略.........
开发者ID:Fantu,项目名称:muffin,代码行数:101,代码来源:menu.c
注:本文中的GDK_WINDOW_XDISPLAY函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论