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


C++ GDK_WINDOW_XID函数代码示例

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


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

示例1: empathy_video_widget_expose_event

static gboolean
empathy_video_widget_expose_event (GtkWidget *widget, GdkEventExpose *event)
{
  EmpathyVideoWidget *self = EMPATHY_VIDEO_WIDGET (widget);
  EmpathyVideoWidgetPriv *priv = GET_PRIV (self);

  if (event != NULL && event->count > 0)
    return TRUE;

  if (priv->overlay == NULL)
    return TRUE;

  gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (priv->overlay),
    GDK_WINDOW_XID (widget->window));

  gst_x_overlay_expose (GST_X_OVERLAY (priv->overlay));

  return TRUE;
}
开发者ID:Elleo,项目名称:empathy,代码行数:19,代码来源:empathy-video-widget.c

示例2: gdk_x11_window_force_focus

void
gdk_x11_window_force_focus (GdkWindow *window,
                            guint32    timestamp)
{
    GdkDisplay *display;

    g_return_if_fail (GDK_IS_WINDOW (window));

    display = GDK_WINDOW_DISPLAY (window);

    if (GTK_CHECK_VERSION(3,0,0) && !GDK_IS_X11_DISPLAY (display))
        return;

    if (gdk_x11_screen_supports_net_wm_hint (gdk_window_get_screen (window),
                        gdk_atom_intern_static_string ("_NET_ACTIVE_WINDOW")))
    {
        if (!timestamp)
        {
            GTimeVal t;
            g_get_current_time (&t);
            timestamp = t.tv_sec;
        }

        XClientMessageEvent xclient;

        memset (&xclient, 0, sizeof (xclient));
        xclient.type = ClientMessage;
        xclient.window = GDK_WINDOW_XID (window);
        xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display,
                                                                    "_NET_ACTIVE_WINDOW");
        xclient.format = 32;
        xclient.data.l[0] = 2; /* requestor type; we're a tool */
        xclient.data.l[1] = timestamp;
        xclient.data.l[2] = None; /* currently active window */
        xclient.data.l[3] = 0;
        xclient.data.l[4] = 0;

        XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XROOTWIN (window), False,
                    SubstructureRedirectMask | SubstructureNotifyMask,
                    (XEvent *)&xclient);
    }
}
开发者ID:vovochka404,项目名称:deadbeef-statusnotifier-plugin,代码行数:42,代码来源:x11-force-focus.c

示例3: gtk_im_context_vn_event_filter

//-----------------------------------------
// based on code contributed by pclouds
//-----------------------------------------
static GdkFilterReturn
gtk_im_context_vn_event_filter (GdkXEvent *xevent,
				GdkEvent *event,
				gpointer data)
{
  XPropertyEvent *ev = (XPropertyEvent*)xevent;
  long v;
  GdkWindow *gdkroot = gdk_get_default_root_window();
  Window root = GDK_WINDOW_XID(gdkroot);

  if (!ev ||
      ev->type != PropertyNotify ||
      ev->window != root)
    return GDK_FILTER_CONTINUE;
  
  
  if (ev->atom == AIMCharset) {
    v = UkGetPropValue(ev->atom, VKC_UTF8);
    GlobalOpt.charset = SyncToUnikeyCharset(v);
    UnikeySetOutputCharset(GlobalOpt.charset);
    /*
    if (UkMacroLoaded)
      UkUpdateMacroTable(GlobalOpt.charset);
    */
    return GDK_FILTER_REMOVE;
  }
  else if (ev->atom == AIMMethod) {
    fixSyncToUnikeyMethod();
    if (GlobalOpt.enabled)
      UnikeySetInputMethod(GlobalOpt.inputMethod);
    return GDK_FILTER_REMOVE;
  }
  else if (ev->atom == AIMUsing) {
    //dont' need this
    return GDK_FILTER_REMOVE;
  }
  else if (ev->atom == AGUIVisible) {
    UkGUIVisible = UkGetPropValue(AGUIVisible, 0);
  }

  return GDK_FILTER_CONTINUE;
}
开发者ID:NgoHuy,项目名称:unikey,代码行数:45,代码来源:gtkimcontextvn.c

示例4: ungrab_mmkey

static void
ungrab_mmkey (int key_code,
	      GdkWindow *root)
{
	Display *display;
	gdk_error_trap_push ();

	display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
	XUngrabKey (display, key_code, 0, GDK_WINDOW_XID (root));
	XUngrabKey (display, key_code, Mod2Mask, GDK_WINDOW_XID (root));
	XUngrabKey (display, key_code, Mod5Mask, GDK_WINDOW_XID (root));
	XUngrabKey (display, key_code, LockMask, GDK_WINDOW_XID (root));
	XUngrabKey (display, key_code, Mod2Mask | Mod5Mask, GDK_WINDOW_XID (root));
	XUngrabKey (display, key_code, Mod2Mask | LockMask, GDK_WINDOW_XID (root));
	XUngrabKey (display, key_code, Mod5Mask | LockMask, GDK_WINDOW_XID (root));
	XUngrabKey (display, key_code, Mod2Mask | Mod5Mask | LockMask, GDK_WINDOW_XID (root));

	gdk_flush ();
        if (gdk_error_trap_pop ()) {
		rb_debug ("Error grabbing key");
	}
}
开发者ID:arnaudlecam,项目名称:rhythmbox,代码行数:22,代码来源:rb-mmkeys-plugin.c

示例5: GLB_DrawInit

//================================================================
  int GLB_DrawInit (void *widget) {
//================================================================
/// GLB_DrawInit          start OpenGL-commandblock

  GdkWindow     *window;

  if(!GLB_x_id) {

    window = gtk_widget_get_window (widget);
    GLB_x_id = GDK_WINDOW_XID(window);                // causes expose!
      printf("  GLB_x_id=%d\n",GLB_x_id);
  }

  // GLB_x_context = glXCreateContext (GLB_display, xvisual, NULL, TRUE);

  glXMakeCurrent (GLB_display, GLB_x_id, GLB_x_context);

  return 0;

}
开发者ID:NoSuchProcess,项目名称:gcad3d,代码行数:21,代码来源:gtk_gl_x11.c

示例6: uninstall_keygrab

static void uninstall_keygrab(void)
{
        GdkDisplay *display = gdk_display_get_default();
        int i;

        for (i = 0; i < gdk_display_get_n_screens (display); i++) {
                GdkScreen *screen;
                GdkWindow *root;

                screen = gdk_display_get_screen (display, i);
                if (!screen) {
                        continue;
                }
                root = gdk_screen_get_root_window (screen);
                XUngrabKey(GDK_DISPLAY(),
                           AnyKey,
                           AnyModifier,
                           GDK_WINDOW_XID(root));
        }
}
开发者ID:BackupTheBerlios,项目名称:ocha-svn,代码行数:20,代码来源:ochad_main.c

示例7: gtk_widget_get_window

void GTKVideo::realize_cb(GtkWidget *widget, void *user_data) {
  GTKVideo *context = static_cast<GTKVideo *>(user_data);
  GdkWindow *window = gtk_widget_get_window(widget);
  if (!gdk_window_ensure_native(window))
    g_debug("Couldn't create native window needed for GstXOverlay!");
  gdk_threads_enter();
  gdk_display_sync(context->display_);
  // gdk_error_trap_pop ();
  /* Retrieve window handler from GDK */
#if defined(GDK_WINDOWING_WIN32)
  context->window_handle_ = reinterpret_cast<guintptr>(GDK_WINDOW_HWND(window));
#elif defined(GDK_WINDOWING_QUARTZ)
  context->window_handle_ = gdk_quartz_window_get_nsview(window);
#elif defined(GDK_WINDOWING_X11)
  context->window_handle_ = GDK_WINDOW_XID(window);
#endif
  gdk_threads_leave();
  std::unique_lock<std::mutex> lock(context->wait_window_mutex_);
  context->wait_window_cond_.notify_all();
}
开发者ID:dulton,项目名称:switcher,代码行数:20,代码来源:gtkvideo.cpp

示例8: gtku_gl_drawing_area_swap_buffers

void
gtku_gl_drawing_area_swap_buffers (GtkuGLDrawingArea * self)
{
    GtkWidget * widget = GTK_WIDGET (self);
    GtkuGLDrawingAreaPrivate * priv = GTKU_GL_DRAWING_AREA_GET_PRIVATE (self);

#ifdef USE_VBLANK
    if (priv->vblank_watch) {
        /* If we are syncing to vblank, we just set a flag that a
         * swap is desired. */
        priv->swap_requested = 1;
        return;
    }
#endif
    /* If we can't monitor vblank, we swap immediately. */
    if (!GTK_WIDGET_REALIZED (widget) || !priv->dpy)
        return;

    glXSwapBuffers (priv->dpy, GDK_WINDOW_XID (widget->window));
}
开发者ID:Patrick6289,项目名称:navguide,代码行数:20,代码来源:gtkgldrawingarea.c

示例9: getWindowHandleString

Ogre::String getWindowHandleString(GtkWidget *widget)
{
    Ogre::String handle;
    // GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
    gtk_widget_realize(widget);
    GdkWindow *parent = gtk_widget_get_parent_window(widget);

//    gdk_window_show(parent);

#if defined(__WIN32__) || defined(_WIN32)

    handle = Ogre::StringConverter::toString((unsigned long) GDK_WINDOW_HWND(parent));

#else
// #elif defined(__WXGTK__)

    GdkDisplay* display = gdk_drawable_get_display(GDK_DRAWABLE(parent));
    Display *xdisplay = GDK_DISPLAY_XDISPLAY(display);
    XSync(xdisplay, false);


    GdkScreen* screen = gdk_drawable_get_screen(GDK_DRAWABLE(parent));
    Screen *xscreen = GDK_SCREEN_XSCREEN(screen);
    int screen_number = XScreenNumberOfScreen(xscreen);
//    XID xid_parent = GDK_WINDOW_XWINDOW(parent);

    // "parentWindowHandle"
//    handle =
//        Ogre::StringConverter::toString(reinterpret_cast<unsigned long>(xdisplay)) + ":" +
//        Ogre::StringConverter::toString(static_cast<unsigned int>(screen_number)) + ":" +
//        Ogre::StringConverter::toString(static_cast<unsigned long>(xid_parent));

    handle = Ogre::StringConverter::toString(static_cast<unsigned long>(GDK_WINDOW_XID(parent)));


#endif

    // dunno what MacOS needs - you tell me

    return handle;
}
开发者ID:gitpan,项目名称:Ogre,代码行数:41,代码来源:perlOGREGUI.cpp

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

示例11: on_draw

static gboolean on_draw(GtkWidget* w, cairo_t* cr, gpointer data)
{
    g_debug("%s", __func__);
    if (ctx == 0 || glxwin == 0 || glx_pm == 0) return TRUE;

    glXMakeContextCurrent(display, glxwin, glxwin, ctx);
    glViewport (0, 0, g_width, g_height);

    GdkWindow* gdkwin = gtk_widget_get_window(w);

    XWindowAttributes  gwa;
    XGetWindowAttributes(display, GDK_WINDOW_XID(gdkwin), &gwa);
    glViewport(0, 0, gwa.width, gwa.height);

    glClearColor(1.0, 1.0, 1.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);

    glEnable(GL_TEXTURE_2D);
    GLuint texture;

    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);

    glXBindTexImageEXT(display, glx_pm, GLX_FRONT_EXT, NULL);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

    glBegin(GL_QUADS);
        glTexCoord2f(0.0, 0.0); glVertex3f(-1.0,  1.0, 0.0);
        glTexCoord2f(1.0, 0.0); glVertex3f( 1.0,  1.0, 0.0);
        glTexCoord2f(1.0, 1.0); glVertex3f( 1.0, -1.0, 0.0);
        glTexCoord2f(0.0, 1.0); glVertex3f(-1.0, -1.0, 0.0);
    glEnd(); 

    if (dbuffered) glXSwapBuffers(display, glxwin);
    else glFlush(); 

    /*glXMakeCurrent(display, 0, 0);*/
    return TRUE;
}
开发者ID:sonald,项目名称:glxdemo,代码行数:41,代码来源:main.c

示例12: unique_backend_get_workspace

/**
 * unique_backend_get_workspace:
 * @backend: a #UniqueBackend
 *
 * Retrieves the current workspace.
 *
 * Return value: a workspace number
 */
guint
unique_backend_get_workspace (UniqueBackend *backend)
{
  GdkDisplay *display;
  GdkWindow *root_win;
#ifdef GDK_WINDOWING_X11
  Atom _net_current_desktop, type;
  int format;
  unsigned long n_items, bytes_after;
  unsigned char *data_return = 0;
#endif

  g_return_val_if_fail (UNIQUE_IS_BACKEND (backend), 0);

  if (backend->workspace != -1)
    return backend->workspace;

  display = gdk_screen_get_display (backend->screen);
  root_win = gdk_screen_get_root_window (backend->screen);

#ifdef GDK_WINDOWING_X11
  _net_current_desktop =
    gdk_x11_get_xatom_by_name_for_display (display, "_NET_CURRENT_DESKTOP");

  XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display),
                      GDK_WINDOW_XID (root_win),
                      _net_current_desktop,
                      0, G_MAXLONG,
                      False, XA_CARDINAL,
                      &type, &format, &n_items, &bytes_after,
                      &data_return);

  if (type == XA_CARDINAL && format == 32 && n_items > 0)
    {
      backend->workspace = (guint) data_return[0];
      XFree (data_return);
    }
#endif

  return backend->workspace;
}
开发者ID:GNOME,项目名称:unique,代码行数:49,代码来源:uniquebackend.c

示例13: gedit_utils_get_window_workspace

/**
 * gedit_utils_get_window_workspace: Get the workspace the window is on
 *
 * This function gets the workspace that the #GtkWindow is visible on,
 * it returns GEDIT_ALL_WORKSPACES if the window is sticky, or if
 * the window manager doesn support this function
 */
guint
gedit_utils_get_window_workspace (GtkWindow *gtkwindow)
{
#ifdef GDK_WINDOWING_X11
	GdkWindow *window;
	GdkDisplay *display;
	Atom type;
	gint format;
	gulong nitems;
	gulong bytes_after;
	guint *workspace;
	gint err, result;
	guint ret = GEDIT_ALL_WORKSPACES;

	g_return_val_if_fail (GTK_IS_WINDOW (gtkwindow), 0);
	g_return_val_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (gtkwindow)), 0);

	window = gtk_widget_get_window (GTK_WIDGET (gtkwindow));
	display = gdk_drawable_get_display (window);

	gdk_error_trap_push ();
	result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
				     gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"),
				     0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems,
				     &bytes_after, (gpointer) &workspace);
	err = gdk_error_trap_pop ();

	if (err != Success || result != Success)
		return ret;

	if (type == XA_CARDINAL && format == 32 && nitems > 0)
		ret = workspace[0];

	XFree (workspace);
	return ret;
#else
	/* FIXME: on mac etc proably there are native APIs
	 * to get the current workspace etc */
	return 0;
#endif
}
开发者ID:kaushikmit,项目名称:gedit,代码行数:48,代码来源:gedit-utils.c

示例14: empathy_video_widget_sync_message_cb

static void
empathy_video_widget_sync_message_cb (GstBus *bus, GstMessage *message,
  EmpathyVideoWidget *self)
{
  EmpathyVideoWidgetPriv *priv = GET_PRIV (self);
  const GstStructure *s;

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

  if (GST_MESSAGE_SRC (message) != (GstObject *) priv->overlay)
    return;

  s = gst_message_get_structure (message);

  if (gst_structure_has_name (s, "prepare-xwindow-id"))
    {
      gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (priv->overlay),
        GDK_WINDOW_XID (GTK_WIDGET (self)->window));
    }
}
开发者ID:Elleo,项目名称:empathy,代码行数:21,代码来源:empathy-video-widget.c

示例15: qtcWindowStatusBarDBus

void
qtcWindowStatusBarDBus(GtkWidget *widget, gboolean state)
{
    GtkWindow *topLevel = GTK_WINDOW(gtk_widget_get_toplevel(widget));
    unsigned int xid = GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(topLevel)));

    char cmd[160];
    //sprintf(cmd, "qdbus org.kde.kwin /QtCurve statusBarState %u %s", xid, state ? "true" : "false");
    sprintf(cmd, "dbus-send --type=method_call --session --dest=org.kde.kwin /QtCurve org.kde.QtCurve.statusBarState uint32:%u boolean:%s",
            xid, state ? "true" : "false");
    system(cmd);
    /*
      char         xidS[16],
      stateS[6];
      char         *args[]={"qdbus", "org.kde.kwin", "/QtCurve", "statusBarState", xidS, stateS, NULL};

      sprintf(xidS, "%u", xid);
      sprintf(stateS, "%s", state ? "true" : "false");
      g_spawn_async("/tmp", args, NULL, (GSpawnFlags)0, NULL, NULL, NULL, NULL);
    */
}
开发者ID:Kermit,项目名称:qtcurve,代码行数:21,代码来源:window.c


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