当前位置: 首页>>代码示例>>C++>>正文


C++ GDK_WINDOW_XDISPLAY函数代码示例

本文整理汇总了C++中GDK_WINDOW_XDISPLAY函数的典型用法代码示例。如果您正苦于以下问题:C++ GDK_WINDOW_XDISPLAY函数的具体用法?C++ GDK_WINDOW_XDISPLAY怎么用?C++ GDK_WINDOW_XDISPLAY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GDK_WINDOW_XDISPLAY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的GDK_WINDOW_XDISPLAY函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。