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


C++ GDK_WINDOW_XWINDOW函数代码示例

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


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

示例1: InitGroupLeader

static gboolean
InitGroupLeader(Window *groupLeader,
                Window *rootWindow)
{
   Window myGroupLeader;
   Window myRootWindow;
   XSetWindowAttributes attr;
   GdkDisplay *gdkDisplay;
   GdkWindow *gdkLeader;

   attr.override_redirect = True;

   ASSERT(groupLeader);
   ASSERT(rootWindow);

   gdkDisplay = gdk_display_get_default();
   gdkLeader = gdk_display_get_default_group(gdkDisplay);
   myGroupLeader = GDK_WINDOW_XWINDOW(gdkLeader);
   myRootWindow = GDK_ROOT_WINDOW();

   ASSERT(myGroupLeader);
   ASSERT(myRootWindow);

   /* XXX: With g_set_prgname() being called, this can probably go away. */
   XStoreName(GDK_DISPLAY(), myGroupLeader, VMUSER_TITLE);

   /*
    * Sanity check:  Set the override redirect property on our group leader
    * window (not default), then re-parent it to the root window (default).
    * This makes sure that (a) a window manager can't re-parent our window,
    * and (b) that we remain a top-level window.
    */
   XChangeWindowAttributes(GDK_DISPLAY(), myGroupLeader, CWOverrideRedirect,
                           &attr);
   XReparentWindow(GDK_DISPLAY(), myGroupLeader, myRootWindow, 10, 10);
   XSync(GDK_DISPLAY(), FALSE);

   *groupLeader = myGroupLeader;
   *rootWindow = myRootWindow;

   return TRUE;
}
开发者ID:SvenDowideit,项目名称:open-vm-tools,代码行数:42,代码来源:x11Lock.c

示例2: na_tray_child_force_redraw

/* If we are faking transparency with a window-relative background, force a
 * redraw of the icon. This should be called if the background changes or if
 * the child is shifted with respect to the background.
 */
void
na_tray_child_force_redraw (NaTrayChild *child)
{
  GtkWidget *widget = GTK_WIDGET (child);

  if (GTK_WIDGET_MAPPED (child) && child->parent_relative_bg)
    {
#if 1
      /* Sending an ExposeEvent might cause redraw problems if the
       * icon is expecting the server to clear-to-background before
       * the redraw. It should be ok for GtkStatusIcon or EggTrayIcon.
       */
      Display *xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget));
      XEvent xev;

      xev.xexpose.type = Expose;
      xev.xexpose.window = GDK_WINDOW_XWINDOW (GTK_SOCKET (child)->plug_window);
      xev.xexpose.x = 0;
      xev.xexpose.y = 0;
      xev.xexpose.width = widget->allocation.width;
      xev.xexpose.height = widget->allocation.height;
      xev.xexpose.count = 0;

      gdk_error_trap_push ();
      XSendEvent (GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (widget)),
                  xev.xexpose.window,
                  False, ExposureMask,
                  &xev);
      /* We have to sync to reliably catch errors from the XSendEvent(),
       * since that is asynchronous.
       */
      XSync (xdisplay, False);
      gdk_error_trap_pop ();
#else
      /* Hiding and showing is the safe way to do it, but can result in more
       * flickering.
       */
      gdk_window_hide (widget->window);
      gdk_window_show (widget->window);
#endif
    }
}
开发者ID:RainCT,项目名称:gnome-shell,代码行数:46,代码来源:na-tray-child.c

示例3: screenAvailableRect

FloatRect screenAvailableRect(Widget* widget)
{
    if (!widget)
        return FloatRect();

#if PLATFORM(X11)
    GtkWidget* container = GTK_WIDGET(widget->root()->hostWindow()->platformPageClient());
    if (!container)
        return FloatRect();

    if (!gtk_widget_get_realized(container))
        return screenRect(widget);

    GdkDrawable* rootWindow = GDK_DRAWABLE(gtk_widget_get_root_window(container));
    GdkDisplay* display = gdk_drawable_get_display(rootWindow);
    Atom xproperty = gdk_x11_get_xatom_by_name_for_display(display, "_NET_WORKAREA");

    Atom retType;
    int retFormat;
    long *workAreaPos = NULL;
    unsigned long retNItems;
    unsigned long retAfter;
    int xRes = XGetWindowProperty(GDK_DISPLAY_XDISPLAY(display), GDK_WINDOW_XWINDOW(rootWindow), xproperty,
        0, 4, FALSE, XA_CARDINAL, &retType, &retFormat, &retNItems, &retAfter, (guchar**)&workAreaPos);

    FloatRect rect;
    if (xRes == Success && workAreaPos != NULL && retType == XA_CARDINAL && retNItems == 4 && retFormat == 32) {
        rect = FloatRect(workAreaPos[0], workAreaPos[1], workAreaPos[2], workAreaPos[3]);
        // rect contains the available space in the whole screen not just in the monitor
        // containing the widget, so we intersect it with the monitor rectangle.
        rect.intersect(screenRect(widget));
    } else
        rect = screenRect(widget);

    if (workAreaPos)
        XFree(workAreaPos);

    return rect;
#else
    return screenRect(widget);
#endif
}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:42,代码来源:PlatformScreenGtk.cpp

示例4: 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

示例5: drawPixmap

static void
drawPixmap(PluginInstance *This)
{
    if (nullPluginGdkPixmap)
    {
        int pixmap_with, pixmap_height, dest_x, dest_y;
        gdk_drawable_get_size((GdkWindow *)nullPluginGdkPixmap, &pixmap_with, &pixmap_height);
        dest_x = This->width/2 - pixmap_with/2;
        dest_y = This->height/2 - pixmap_height/2;
        if (dest_x >= 0 && dest_y >= 0)
        {
#ifdef MOZ_X11
            GC gc;
            gc = XCreateGC(This->display, This->window, 0, NULL);
            XCopyArea(This->display, GDK_WINDOW_XWINDOW(nullPluginGdkPixmap) , This->window, gc,
                0, 0, pixmap_with, pixmap_height, dest_x, dest_y);
            XFreeGC(This->display, gc);
#endif
        }
    }
}
开发者ID:amyvmiwei,项目名称:firefox,代码行数:21,代码来源:nullplugin.c

示例6: b4_handler

void b4_handler(GtkWidget *widget) {
  JVMP_DrawingSurfaceInfo w;

  if (!jvmp_context) return;
  jint containerWindowID = (jint) GDK_WINDOW_XWINDOW(topLevel->window);
  w.window =  (JPluginWindow *)containerWindowID;
#ifdef XP_UNIX
  gdk_flush();
#endif
  w.x = 0;
  w.y = 0;
  w.width  = topLevel->allocation.width;
  w.height = topLevel->allocation.height;

  if ((jvmp_context->JVMP_RegisterWindow)(ctx, &w, &g_wid) != JNI_TRUE) {
    jvmp_context->JVMP_GetLastErrorString(ctx, g_errbuf);
    fprintf(stderr, "Can\'t register window: %s\n", g_errbuf);
    return;
  };
  fprintf(stderr, "Registed our GTK window with ID %d\n", (int)g_wid);
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:21,代码来源:host.cpp

示例7: gtk_sdl_surface_attach

static void gtk_sdl_surface_attach(GtkSDL *sdl)
{
    gchar SDL_windowhack[32];

    /* puts ("before sdl surface attach"); */

    /* Attach the SDL_Surface */

    /* puts ("attaching the surface"); */

    sprintf(SDL_windowhack, "SDL_WINDOWID=%ld",
            GDK_WINDOW_XWINDOW( GTK_WIDGET(sdl)->window ) );
    /* puts(SDL_windowhack); */
    putenv(SDL_windowhack);

    SDL_QuitSubSystem(SDL_INIT_VIDEO);
    /* puts ("before creating new surface"); */
    if ( SDL_InitSubSystem ( SDL_INIT_VIDEO ) < 0) {
        fprintf (stderr, "unable to init SDL: %s", SDL_GetError() );
        return;
    }
    /* puts ("after creating new surface"); */

    if (sdl->flags &= (SDL_OPENGLBLIT | SDL_DOUBLEBUF)) {
        SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
    }

    if (sdl->surface) {
        /* puts ("TODO: deallocate previus surface"); */
        SDL_FreeSurface(sdl->surface);
    }

    sdl->surface = SDL_SetVideoMode(sdl->width, sdl->height, sdl->bpp, sdl->flags);
    if (!sdl->surface) {
        fprintf (stderr, "Unable to set the video mode: %s", SDL_GetError() );
        return;
    }

    /* puts ("after sdl surface attach"); */
}
开发者ID:zenki2001cn,项目名称:SnippetCode,代码行数:40,代码来源:gtksdl.c

示例8: 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

示例9: acam_webcam_bus_sync_handler

static GstBusSyncReply
acam_webcam_bus_sync_handler (GstBus *bus, GstMessage *message, acam_webcam_device_s *acam_webcam_device)
{
	GstXOverlay *overlay;

	if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
		return GST_BUS_PASS;

	if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
		return GST_BUS_PASS;

	overlay = GST_X_OVERLAY (GST_MESSAGE_SRC (message));

	if (g_object_class_find_property (G_OBJECT_GET_CLASS (overlay), "force-aspect-ratio"))
		g_object_set (G_OBJECT (overlay), "force-aspect-ratio", TRUE, NULL);

	gst_x_overlay_set_xwindow_id (overlay, GDK_WINDOW_XWINDOW (gtk_widget_get_window (acam_webcam_device->video_screen)));

	gst_message_unref (message);

	return GST_BUS_DROP;
}
开发者ID:andypc,项目名称:aCam,代码行数:22,代码来源:acam_webcam_setup.c

示例10: startDaemon

		void startDaemon(int daemonPort, bool fullscreen, bool drawIntoRoot, bool disableVideo, bool disableAudio, bool vdpau, signed long xid) {
      if(vdpau) {
        LOG(INFO) << "Trying to use VDPAU";
        factory.getServerTemplates().videoConvert="vdpauvideopostprocess";
        factory.getServerTemplates().videoSink="vdpausink name=vpsink";
      } else if(xid == -1) {
				if(!disableVideo) {
					if(!checkXvExtension())
						factory.getServerTemplates().videoSink="ximagesink name=vpsink";

					if(!drawIntoRoot) {
						GtkWidget* gtkWin = makeGtkWindow(fullscreen);
						xid = GDK_WINDOW_XWINDOW(gtkWin->window);
					} else {
						Display* dis = XOpenDisplay(NULL);
						xid = RootWindow(dis,0);
					}
				}
			}

			CapsServer server(daemonPort);
			while (true) {
				LOG(INFO) << "Waiting for incoming connection";
				ClientInfo ci = server.accept(disableVideo, disableAudio);
				LOG(INFO) << "Accepted connection: " << ci.peerAddress;

				if (pipeline != NULL && pipeline->isRunning()) {
					pipeline->stop();
					delete pipeline;
				}

				pipeline = factory.createServerPipeline(daemonPort, ci);

				if(!disableVideo && !vdpau)
					pipeline->setXwindowID(xid);
				pipeline->play(false);
			}
		}
开发者ID:kallaballa,项目名称:Cheesy,代码行数:38,代码来源:cheesy.cpp

示例11: wxXGetWindowProperty

static bool wxXGetWindowProperty(GdkWindow* window, Atom& type, int& format, gulong& nitems, guchar*& data)
{
    bool success = false;
#if GTK_CHECK_VERSION(2, 2, 0)
    if (gtk_check_version(2, 2, 0) == NULL)
    {
        gulong bytes_after;
        success = XGetWindowProperty(
            GDK_DISPLAY_XDISPLAY(gdk_drawable_get_display(window)),
            GDK_WINDOW_XWINDOW(window),
            gdk_x11_get_xatom_by_name_for_display(
                gdk_drawable_get_display(window),
                "_NET_FRAME_EXTENTS"),
            0, // left, right, top, bottom, CARDINAL[4]/32
            G_MAXLONG, // size of long
            false, // do not delete property
            XA_CARDINAL, // 32 bit
            &type, &format, &nitems, &bytes_after, &data
            ) == Success;
    }
#endif
    return success;
}
开发者ID:SCP-682,项目名称:Cities3D,代码行数:23,代码来源:settings.cpp

示例12: 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

示例13: set_desktop_window_id

static void
set_desktop_window_id (CajaDesktopWindow *window,
                       GdkWindow             *gdkwindow)
{
    /* Tuck the desktop windows xid in the root to indicate we own the desktop.
     */
    Window window_xid;
    GdkWindow *root_window;

    root_window = gdk_screen_get_root_window (
                      gtk_window_get_screen (GTK_WINDOW (window)));

#if GTK_CHECK_VERSION (3, 0, 0)
    window_xid = GDK_WINDOW_XID (gdkwindow);
#else
    window_xid = GDK_WINDOW_XWINDOW (gdkwindow);
#endif

    gdk_property_change (root_window,
                         gdk_atom_intern ("CAJA_DESKTOP_WINDOW_ID", FALSE),
                         gdk_x11_xatom_to_atom (XA_WINDOW), 32,
                         GDK_PROP_MODE_REPLACE, (guchar *) &window_xid, 1);
}
开发者ID:City-busz,项目名称:caja,代码行数:23,代码来源:caja-desktop-window.c

示例14: init_composite

gboolean
init_composite (void)
{
  Display *display;
  display = gdk_x11_get_default_xdisplay ();

  // First, check the Composite extension, then the Render extension.
  int error_base;
  int event_base;
  int version_major;
  int version_minor;

  if (!XCompositeQueryExtension (display, &event_base, &error_base)) {
    return FALSE;
  }

  // We need at least version 0.2, for XCompositeNameWindowPixmap.
  XCompositeQueryVersion (display, &version_major, &version_minor);
  if (version_major <= 0 && version_minor < 2) {
    return FALSE;
  }

  if (!XRenderQueryExtension (display, &event_base, &error_base)) {
    return FALSE;
  }

  // We need at least version 0.6, for XRenderSetPictureTransform.
  XRenderQueryVersion (display, &version_major, &version_minor);
  if (version_major <= 0 && version_minor < 6) {
    return FALSE;
  }

  XCompositeRedirectSubwindows (display,
      GDK_WINDOW_XWINDOW (gdk_get_default_root_window ()),
      CompositeRedirectAutomatic);
  return TRUE;
}
开发者ID:fidergo-stephane-gourichon,项目名称:superswitcher,代码行数:37,代码来源:thumbnailer.c

示例15: pn_init

/* **************** basic renderer management **************** */
void
pn_init (void)
{
  int i;
#ifdef FULLSCREEN_HACK
  char SDL_windowhack[32];
  GdkScreen *screen;
#endif

  pn_sound_data = g_new0 (struct pn_sound_data, 1);
  pn_image_data = g_new0 (struct pn_image_data, 1);

#ifdef FULLSCREEN_HACK
  screen = gdk_screen_get_default();
  sprintf(SDL_windowhack,"SDL_WINDOWID=%d",
          GDK_WINDOW_XWINDOW(gdk_screen_get_root_window(screen)));
          putenv(SDL_windowhack);
#endif

  if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE) < 0)
    pn_fatal_error ("Unable to initialize SDL: %s", SDL_GetError ());

#ifndef FULLSCREEN_HACK
  resize_video (640, 360);
#else
  resize_video (1280, 1024);
#endif

  SDL_WM_SetCaption ("Paranormal Visualization Studio", PACKAGE);

  for(i=0; i<360; i++)
    {
      sin_val[i] = sin(i*(M_PI/180.0));
      cos_val[i] = cos(i*(M_PI/180.0));
    }
}
开发者ID:Starlon,项目名称:FroyVisuals-old,代码行数:37,代码来源:paranormal.c


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