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


C++ GDK_ROOT_WINDOW函数代码示例

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


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

示例1: grab_window

int grab_window(int src_x, int src_y, int width, int height)
{
	GdkWindow *window, *root;
#ifndef GTK3
	window = gdk_window_foreign_new(GDK_ROOT_WINDOW());
	root = gdk_window_foreign_new(GDK_ROOT_WINDOW());
#else
	GdkDisplay *gdpy = gdk_display_get_default();
	window = root = gdk_x11_window_foreign_new_for_display(gdpy, GDK_ROOT_WINDOW());
#endif

  GdkPixbuf *screenshot;
	GError *error = NULL;

  if (src_x + width > gdk_screen_width ())
  	width = gdk_screen_width () - src_x;
  if (src_y + height > gdk_screen_height ())
   	height = gdk_screen_height () - src_y;

	time_t now;
	time(&now);
	char path[MAXPATHLEN];
	snprintf(path, sizeof(path), "%s%i%s", "./screen-shot-window", now, ".png");
	printf("%s\n", path);
#ifndef GTK3
  screenshot = gdk_pixbuf_get_from_drawable (NULL, root, NULL, src_x, src_y, 0, 0, width, height);
#else
	screenshot = gdk_pixbuf_get_from_window(root, src_x, src_y, width, height);
#endif

	printf("----------------%d\n", gdk_pixbuf_get_rowstride(screenshot));
	gdk_pixbuf_save (screenshot, path, "png", &error, "tEXt::CREATOR", "gnome-panel-screenshot", NULL);

	return 0;
}
开发者ID:ahqmhjk,项目名称:image-scale-view,代码行数:35,代码来源:capture.c

示例2: set_num_screens

// the following function is stolen from xfdesktop
static void
set_num_screens (gpointer num)
{
    static Atom xa_NET_NUMBER_OF_DESKTOPS = 0;
    XClientMessageEvent sev;
    int n;

    if (!xa_NET_NUMBER_OF_DESKTOPS)
    {
	xa_NET_NUMBER_OF_DESKTOPS =
	    XInternAtom (GDK_DISPLAY (), "_NET_NUMBER_OF_DESKTOPS", False);
    }

    n = GPOINTER_TO_INT (num);

    sev.type = ClientMessage;
    sev.display = GDK_DISPLAY ();
    sev.format = 32;
    sev.window = GDK_ROOT_WINDOW ();
    sev.message_type = xa_NET_NUMBER_OF_DESKTOPS;
    sev.data.l[0] = n;

    gdk_error_trap_push ();

    XSendEvent (GDK_DISPLAY (), GDK_ROOT_WINDOW (), False,
		SubstructureNotifyMask | SubstructureRedirectMask,
		(XEvent *) & sev);

    gdk_flush ();
    gdk_error_trap_pop ();
}
开发者ID:BackupTheBerlios,项目名称:xfce-goodies-svn,代码行数:32,代码来源:windowlist.c

示例3: grab_keys

void grab_keys(int mk, int uk, int dk,
	       int mm, int um, int dm,
	       int step) {
  Display* disp = GDK_DISPLAY();

  // ungrab any previous keys
  XUngrabKey(disp, AnyKey, AnyModifier, GDK_ROOT_WINDOW());

  volMuteKey = mk;
  volUpKey = uk;
  volDownKey = dk;
  volMuteMods = mm;
  volUpMods = um;
  volDownMods = dm;
  volStep = step;

  if (mk < 0 &&
      uk < 0 &&
      dk < 0)
    return;
  
  xErr = 0;
  errBuf = g_malloc(errBufSize*sizeof(gchar));
  printBuf = errBuf + snprintf(errBuf,errBufSize,_("Could not bind the following hotkeys:\n"));
  errBufSize -= (printBuf - errBuf);

  if (muteSymStr) g_free(muteSymStr);
  if (upSymStr)   g_free(upSymStr);
  if (downSymStr) g_free(downSymStr);
  muteSymStr = gtk_accelerator_name(XkbKeycodeToKeysym(GDK_DISPLAY(), volMuteKey, 0, 0),volMuteMods);
  upSymStr = gtk_accelerator_name(XkbKeycodeToKeysym(GDK_DISPLAY(),volUpKey,0, 0),volUpMods);
  downSymStr = gtk_accelerator_name(XkbKeycodeToKeysym(GDK_DISPLAY(), volDownKey, 0, 0),volDownMods);

  XErrorHandler old_hdlr = XSetErrorHandler(errhdl);
  if (volMuteKey > 0) {
    muteSerial = NextRequest(disp);
    XGrabKey(disp,volMuteKey,volMuteMods,GDK_ROOT_WINDOW(),1,GrabModeAsync,GrabModeAsync);
  }

  if (volUpKey > 0) {
    upSerial = NextRequest(disp);
    XGrabKey(disp,volUpKey,volUpMods,GDK_ROOT_WINDOW(),1,GrabModeAsync,GrabModeAsync);
  }

  if (volDownKey > 0) {
    downSerial = NextRequest(disp);
    XGrabKey(disp,volDownKey,volDownMods,GDK_ROOT_WINDOW(),1,GrabModeAsync,GrabModeAsync);
  }

  XFlush(disp);
  XSync(disp, False);
  (void) XSetErrorHandler(old_hdlr);
  
  if (xErr) 
    g_idle_add(idle_report_error, NULL);
  else
    g_free(errBuf);
}
开发者ID:Cw1X,项目名称:pnmixer,代码行数:58,代码来源:hotkeys.c

示例4: grab_whole_screen

int grab_whole_screen()
{	
	GdkWindow *window, *root;
#ifndef GTK3
	window = gdk_window_foreign_new(GDK_ROOT_WINDOW());
	root = gdk_window_foreign_new(GDK_ROOT_WINDOW());
#else
	GdkDisplay *gdpy = gdk_display_get_default();
	window = root = gdk_x11_window_foreign_new_for_display(gdpy, GDK_ROOT_WINDOW());
#endif

  GdkPixbuf *screenshot;
  gint x_real_orig, y_real_orig;
  gint x_orig, y_orig;
  gint real_width, real_height;
  gint width, height;
	GError *error = NULL;
#ifndef GTK3
	gdk_drawable_get_size(window, &real_width, &real_height);
#else
	real_width = gdk_window_get_width(window);
	real_height = gdk_window_get_height(window); 
#endif
	gdk_window_get_origin(window, &x_real_orig, &y_real_orig);

  x_orig = x_real_orig;
  y_orig = y_real_orig;
  width = real_width;
  height = real_height;
 	if (x_orig < 0) {
  	width = width + x_orig;
    x_orig = 0;
  }
  if (y_orig < 0) {
    height = height + y_orig;
    y_orig = 0;
  }

  if (x_orig + width > gdk_screen_width ())
  	width = gdk_screen_width () - x_orig;
  if (y_orig + height > gdk_screen_height ())
   	height = gdk_screen_height () - y_orig;
	char path[MAXPATHLEN];
	time_t now;
	time(&now);
	snprintf(path, sizeof(path), "%s%i%s", "./screen-shot-whole-screen-", now, ".png");

#ifndef GTK3
	screenshot = gdk_pixbuf_get_from_drawable (NULL, root, NULL, x_orig, y_orig, 0, 0, width, height);
#else
	screenshot = gdk_pixbuf_get_from_window(root, x_orig, y_orig, width, height);
#endif

	gdk_pixbuf_save (screenshot, path, "png", &error, "tEXt::CREATOR", "gnome-panel-screenshot", NULL);
	return 0;
}
开发者ID:ahqmhjk,项目名称:image-scale-view,代码行数:56,代码来源:capture.c

示例5: grabKey

/* Stolen from xfwm4 and modified.
 * FALSE on error. Call initModifiers before this.
 */
static gboolean grabKey(MyKey *key)
{
	Window root;
	Display *dpy = GDK_DISPLAY();
	static gboolean need_init = TRUE;

	if (need_init)
	{
		need_init = FALSE;
		gdk_window_add_filter(gdk_get_default_root_window(),
				filter_keys, NULL);
	}

	gdk_error_trap_push();

	root = GDK_ROOT_WINDOW();

	GRAB(key, 0);

	/* Here we grab all combinations of well known modifiers */
	GRAB(key, ScrollLockMask);
	GRAB(key, NumLockMask);
	GRAB(key, CapsLockMask);
	GRAB(key, ScrollLockMask | NumLockMask);
	GRAB(key, ScrollLockMask | CapsLockMask);
	GRAB(key, CapsLockMask | NumLockMask);
	GRAB(key, ScrollLockMask | CapsLockMask | NumLockMask);

	gdk_flush();
	return gdk_error_trap_pop() == Success;
}
开发者ID:atsampson,项目名称:rox-filer,代码行数:34,代码来源:icon.c

示例6: ics_propertynotify

static void
ics_propertynotify(icons_priv *ics, XEvent *ev)
{
    Atom at;
    Window win;

    
    ENTER;
    win = ev->xproperty.window;
    at = ev->xproperty.atom;
    DBG("win=%lx at=%ld\n", win, at);
    if (win != GDK_ROOT_WINDOW())
    {
	task *tk = find_task(ics, win);

        if (!tk) 
            RET();
        if (at == XA_WM_CLASS)
        {
            get_wmclass(tk);
            set_icon_maybe(ics, tk);
        }
        else if (at == XA_WM_HINTS)
        {
            set_icon_maybe(ics, tk);
        }  
    }
    RET();
}
开发者ID:g7,项目名称:fbpanel,代码行数:29,代码来源:icons.c

示例7: select_popup_events

static void
select_popup_events (void)
{
    XWindowAttributes attr;
    unsigned long     events;

    gdk_error_trap_push ();

    memset (&attr, 0, sizeof (attr));
    XGetWindowAttributes (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), &attr);

    events = SubstructureNotifyMask | attr.your_event_mask;
    XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), events);

    gdk_error_trap_pop_ignored ();
}
开发者ID:electricface,项目名称:dde,代码行数:16,代码来源:shutdowndialog.c

示例8: show_cursor

static void
show_cursor (Doppelganger *dg)
{
  int current_pointer;
  XIEventMask mask = { dg->mpx, 0, "" };

#if 0
  /* probably unnecessary */
  XIGetClientPointer (gdk_x11_get_default_xdisplay (),
		      None,
		      &current_pointer);
  
  /* probably unnecessary */
  XISetClientPointer (gdk_x11_get_default_xdisplay (),
		      None,
		      dg->mpx);

  if (XIGrabDevice (gdk_x11_get_default_xdisplay (),
                    dg->mpx,
                    GDK_ROOT_WINDOW(), CurrentTime,
                    gdk_x11_cursor_get_xcursor (dg->cursor),
                    GrabModeAsync, GrabModeAsync,
                    True, &mask) != GrabSuccess)
    {
      g_warning ("Grab failed.");
    }

  /* probably unnecessary */
  XISetClientPointer (gdk_x11_get_default_xdisplay (),
		      None,
		      current_pointer);

#endif
}
开发者ID:gpoudrel,项目名称:xzibit,代码行数:34,代码来源:doppelganger.c

示例9: update_wm_window

static void
update_wm_window (void)
{
  Window *xwindow;
  Atom type;
  gint format;
  gulong nitems;
  gulong bytes_after;

  XGetWindowProperty (GDK_DISPLAY (), GDK_ROOT_WINDOW (),
		      XInternAtom (GDK_DISPLAY (), "_NET_SUPPORTING_WM_CHECK", False),
		      0, G_MAXLONG, False, XA_WINDOW, &type, &format,
		      &nitems, &bytes_after, (guchar **) &xwindow);

  if (type != XA_WINDOW)
    {
      wm_window = None;
     return;
    }

  gdk_error_trap_push ();
  XSelectInput (GDK_DISPLAY (), *xwindow, StructureNotifyMask | PropertyChangeMask);
  XSync (GDK_DISPLAY (), False);

  if (gdk_error_trap_pop ())
    {
       XFree (xwindow);
       wm_window = None;
       return;
    }

    wm_window = *xwindow;
    XFree (xwindow);
}
开发者ID:federicomenaquintero,项目名称:gnome-control-center,代码行数:34,代码来源:wm-common.c

示例10: title_motion_event

gint title_motion_event(GtkWidget *widget, GdkEventMotion *event)
{
	gint mov_x, mov_y;
	gint win_x, win_y;

	gint xp, yp;
	GdkModifierType mask;
	static GdkWindow *root_win = NULL;

	//LOG(LOG_DEBUG, "IN : title_motion_event()");

	if((event->state & GDK_BUTTON1_MASK) &&
	   bbutton_down){

		root_win = gdk_window_foreign_new (GDK_ROOT_WINDOW ());
		gdk_window_get_pointer (root_win, &xp, &yp, &mask);

	        mov_x = xp - prev_x;
	        mov_y = yp - prev_y;

 	        gdk_window_get_root_origin(popup->window, &win_x, &win_y);

		gtk_window_move(GTK_WINDOW(popup),
				win_x + mov_x,
				win_y + mov_y);
		prev_x = xp;
		prev_y = yp;
	}

	//LOG(LOG_DEBUG, "OUT : title_motion_event()");
	return(FALSE);
}
开发者ID:sina-ht,项目名称:ebview,代码行数:32,代码来源:popup.c

示例11: avatar_image_add_filter

static void
avatar_image_add_filter (EmpathyAvatarImage *avatar_image)
{
	Window     window;
	GdkWindow *gdkwindow;
	gint       mask;

	mask = PropertyChangeMask;

	window = GDK_ROOT_WINDOW ();
	gdkwindow = gdk_xid_table_lookup (window);

	gdk_error_trap_push ();
	if (gdkwindow) {
		XWindowAttributes attrs;
		XGetWindowAttributes (gdk_display, window, &attrs);
		mask |= attrs.your_event_mask;
	}

	XSelectInput (gdk_display, window, mask);

	gdk_error_trap_pop ();

	gdk_window_add_filter (NULL, avatar_image_filter_func, avatar_image);
}
开发者ID:kenvandine,项目名称:empathy,代码行数:25,代码来源:empathy-avatar-image.c

示例12: do_net_client_list

static void
do_net_client_list(GtkWidget *widget, icons *ics)
{
    int i;
    task *tk;

    ENTER;
    if (ics->wins)
        XFree(ics->wins);
    ics->wins = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CLIENT_LIST, XA_WINDOW, &ics->win_num);
    if (!ics->wins)
        RET();

    for (i = 0; i < ics->win_num; i++) {
        if ((tk = g_hash_table_lookup(ics->task_list, &ics->wins[i]))) {
            tk->refcount++;
        } else {
            tk = g_new0(task, 1);
            tk->refcount++;
            ics->num_tasks++;
            tk->win = ics->wins[i];
            tk->ics = ics;

            if (!FBPANEL_WIN(tk->win))
                XSelectInput (GDK_DISPLAY(), tk->win, PropertyChangeMask | StructureNotifyMask);
            get_wmclass(tk);
            set_icon_maybe(ics, tk);
            g_hash_table_insert(ics->task_list, &tk->win, tk);
        }
    }

    /* remove windows that arn't in the NET_CLIENT_LIST anymore */
    g_hash_table_foreach_remove(ics->task_list, (GHRFunc) remove_stale_tasks, NULL);
    RET();
}
开发者ID:BackupTheBerlios,项目名称:fbpanel-svn,代码行数:35,代码来源:icons.c

示例13: __attribute__

JNIEXPORT jint JNICALL
Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetDisplayModeIndex
(JNIEnv *env, jobject obj __attribute__((unused)), jobject gdkGraphicsEnv __attribute__((unused)))
{
#ifdef HAVE_XRANDR	

	GdkDisplay *display;
	XRRScreenConfiguration *config;
	SizeID index;
	Rotation rotation;
	
	display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
	
	gdk_threads_enter();
	
	config = XRRGetScreenInfo (GDK_DISPLAY_XDISPLAY(display), GDK_ROOT_WINDOW());

	index = XRRConfigCurrentConfiguration (config, &rotation);

    XRRFreeScreenConfigInfo (config);

	gdk_threads_leave();
	
	return (int) index;

#else

    JCL_ThrowException(env,
                       "java/lang/InternalError",
                       "Method should not have been invoked.");
   
    return -1;
   
#endif	
}
开发者ID:5432935,项目名称:crossbridge,代码行数:35,代码来源:gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice.c

示例14: get_pixmap_prop

static Pixmap
get_pixmap_prop (Window the_window, char *prop_id)
{
  Atom prop, type;
  int format;
  unsigned long length, after;
  unsigned char *data;


  Window desktop_window = get_desktop_window(the_window);

  if(desktop_window == None)
    desktop_window = GDK_ROOT_WINDOW();

  prop = XInternAtom(GDK_DISPLAY(), prop_id, True);

  if (prop == None)
    return None;

  XGetWindowProperty(GDK_DISPLAY(), desktop_window, prop, 0L, 1L, False,
         AnyPropertyType, &type, &format, &length, &after,
         &data);

  if (type == XA_PIXMAP)
    return *((Pixmap *)data);

  return None;
}
开发者ID:dnohales,项目名称:workrave,代码行数:28,代码来源:desktop-window.c

示例15: pager_net_active_window

/* Handler for "active-window" event from root window listener. */
static void pager_net_active_window(FbEv * ev, PagerPlugin * pg)
{
    Window * focused_window = get_xaproperty(GDK_ROOT_WINDOW(), a_NET_ACTIVE_WINDOW, XA_WINDOW, 0);
    if (focused_window != NULL)
    {
        PagerTask * tk = task_lookup(pg, *focused_window);
        if (tk != pg->focused_task)
        {
            /* Focused task changed.  Redraw both old and new. */
            if (pg->focused_task != NULL)
                desk_set_dirty_by_win(pg, pg->focused_task);
            pg->focused_task = tk;
            if (tk != NULL)
                desk_set_dirty_by_win(pg, tk);
        }
        XFree(focused_window);
    }
    else
    {
        /* Focused task disappeared.  Redraw old. */
        if (pg->focused_task != NULL)
        {
            desk_set_dirty_by_win(pg, pg->focused_task);
            pg->focused_task = NULL;
        }
    }
}
开发者ID:psachin,项目名称:lxpanel,代码行数:28,代码来源:pager.c


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