6/27/2011 9:12:22 AM
2011-06-27 14:56
351 查看
6/27/2011 9:12:22 AM
GdkWindow *
gdk_get_default_root_window (void)
{
return gdk_screen_get_root_window (gdk_screen_get_default ());
}
获取默认屏的root window
struct _GdkDisplay
{
GObject parent_instance;
/*< private >*/
GList *queued_events;
GList *queued_tail;
/* Information for determining if the latest button click
* is part of a double-click or triple-click
*/
guint32 button_click_time[2]; /* The last 2 button click times. */
GdkWindow *button_window[2]; /* The last 2 windows to receive button presses. */
gint button_number[2]; /* The last 2 buttons to be pressed. */
guint double_click_time; /* Maximum time between clicks in msecs */
GdkDevice *core_pointer; /* Core pointer device */
const GdkDisplayPointerHooks *pointer_hooks; /* Current hooks for querying pointer */
guint closed : 1; /* Whether this display has been closed */
guint double_click_distance; /* Maximum distance between clicks in pixels */
gint button_x[2]; /* The last 2 button click positions. */
gint button_y[2];
};
static GdkDisplay *default_display = NULL;
struct _GdkDisplayX11
{
GdkDisplay parent_instance;
Display *xdisplay;
GdkScreen *default_screen;
GdkScreen **screens;
GSource *event_source;
gint grab_count;
/* Keyboard related information */
gint xkb_event_type;
gboolean use_xkb;
/* Whether we were able to turn on detectable-autorepeat using
* XkbSetDetectableAutorepeat. If FALSE, we'll fall back
* to checking the next event with XPending(). */
gboolean have_xkb_autorepeat;
GdkKeymap *keymap;
guint keymap_serial;
gboolean use_xshm;
gboolean have_shm_pixmaps;
GdkTristate have_render;
gboolean have_xfixes;
gint xfixes_event_base;
gboolean have_xcomposite;
gboolean have_xdamage;
gint xdamage_event_base;
/* If the SECURITY extension is in place, whether this client holds
* a trusted authorization and so is allowed to make various requests
* (grabs, properties etc.) Otherwise always TRUE. */
gboolean trusted_client;
/* Information about current pointer and keyboard grabs held by this
* client. If gdk_pointer_xgrab_window or gdk_keyboard_xgrab_window
* window is NULL, then the other associated fields are ignored
*/
GdkWindowObject *pointer_xgrab_window;
gulong pointer_xgrab_serial;
gboolean pointer_xgrab_owner_events;
gboolean pointer_xgrab_implicit;
guint32 pointer_xgrab_time;
GdkWindowObject *keyboard_xgrab_window;
gulong keyboard_xgrab_serial;
gboolean keyboard_xgrab_owner_events;
guint32 keyboard_xgrab_time;
/* drag and drop information */
GdkDragContext *current_dest_drag;
/* data needed for MOTIF DnD */
Window motif_drag_window;
GdkWindow *motif_drag_gdk_window;
GList **motif_target_lists;
gint motif_n_target_lists;
/* Mapping to/from virtual atoms */
GHashTable *atom_from_virtual;
GHashTable *atom_to_virtual;
/* Session Management leader window see ICCCM */
Window leader_window;
GdkWindow *leader_gdk_window;
gboolean leader_window_title_set;
/* list of filters for client messages */
GList *client_filters;
/* List of functions to go from extension event => X window */
GSList *event_types;
/* X ID hashtable */
GHashTable *xid_ht;
/* translation queue */
GQueue *translate_queue;
/* Input device */
/* input GdkDevice list */
GList *input_devices;
/* input GdkWindow list */
GList *input_windows;
gint input_ignore_core;
/* information about network port and host for gxid daemon */
gchar *input_gxid_host;
gint input_gxid_port;
/* Startup notification */
gchar *startup_notification_id;
/* Time of most recent user interaction. */
gulong user_time;
/* Sets of atoms for DND */
guint base_dnd_atoms_precached : 1;
guint xdnd_atoms_precached : 1;
guint motif_atoms_precached : 1;
guint use_sync : 1;
guint have_shapes : 1;
guint have_input_shapes : 1;
/* Alpha mask picture format */
XRenderPictFormat *mask_format;
};
从GDKDisplay 到GDKScreen
GdkWindow *
gdk_screen_get_root_window (GdkScreen *screen)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
return GDK_SCREEN_X11 (screen)->root_window;
}
现在到了rootwindow了
struct _GdkDrawable
{
GObject parent_instance;
};
void
gdk_drawable_get_size (GdkDrawable *drawable,
gint *width,
gint *height)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
GDK_DRAWABLE_GET_CLASS (drawable)->get_size (drawable, width, height);
}
这样就获取了宽和高
pixbuf = gdk_pixbuf_get_from_drawable (NULL,
root_window,
gdk_drawable_get_colormap (root_window),
0, 0,
0, 0,
width, height);
ret = gdk_pixbuf_save (pixbuf, filename, "png", error, NULL);
g_object_unref (pixbuf);
生成一个文件就OK了
GdkWindow *
gdk_get_default_root_window (void)
{
return gdk_screen_get_root_window (gdk_screen_get_default ());
}
获取默认屏的root window
struct _GdkDisplay
{
GObject parent_instance;
/*< private >*/
GList *queued_events;
GList *queued_tail;
/* Information for determining if the latest button click
* is part of a double-click or triple-click
*/
guint32 button_click_time[2]; /* The last 2 button click times. */
GdkWindow *button_window[2]; /* The last 2 windows to receive button presses. */
gint button_number[2]; /* The last 2 buttons to be pressed. */
guint double_click_time; /* Maximum time between clicks in msecs */
GdkDevice *core_pointer; /* Core pointer device */
const GdkDisplayPointerHooks *pointer_hooks; /* Current hooks for querying pointer */
guint closed : 1; /* Whether this display has been closed */
guint double_click_distance; /* Maximum distance between clicks in pixels */
gint button_x[2]; /* The last 2 button click positions. */
gint button_y[2];
};
static GdkDisplay *default_display = NULL;
struct _GdkDisplayX11
{
GdkDisplay parent_instance;
Display *xdisplay;
GdkScreen *default_screen;
GdkScreen **screens;
GSource *event_source;
gint grab_count;
/* Keyboard related information */
gint xkb_event_type;
gboolean use_xkb;
/* Whether we were able to turn on detectable-autorepeat using
* XkbSetDetectableAutorepeat. If FALSE, we'll fall back
* to checking the next event with XPending(). */
gboolean have_xkb_autorepeat;
GdkKeymap *keymap;
guint keymap_serial;
gboolean use_xshm;
gboolean have_shm_pixmaps;
GdkTristate have_render;
gboolean have_xfixes;
gint xfixes_event_base;
gboolean have_xcomposite;
gboolean have_xdamage;
gint xdamage_event_base;
/* If the SECURITY extension is in place, whether this client holds
* a trusted authorization and so is allowed to make various requests
* (grabs, properties etc.) Otherwise always TRUE. */
gboolean trusted_client;
/* Information about current pointer and keyboard grabs held by this
* client. If gdk_pointer_xgrab_window or gdk_keyboard_xgrab_window
* window is NULL, then the other associated fields are ignored
*/
GdkWindowObject *pointer_xgrab_window;
gulong pointer_xgrab_serial;
gboolean pointer_xgrab_owner_events;
gboolean pointer_xgrab_implicit;
guint32 pointer_xgrab_time;
GdkWindowObject *keyboard_xgrab_window;
gulong keyboard_xgrab_serial;
gboolean keyboard_xgrab_owner_events;
guint32 keyboard_xgrab_time;
/* drag and drop information */
GdkDragContext *current_dest_drag;
/* data needed for MOTIF DnD */
Window motif_drag_window;
GdkWindow *motif_drag_gdk_window;
GList **motif_target_lists;
gint motif_n_target_lists;
/* Mapping to/from virtual atoms */
GHashTable *atom_from_virtual;
GHashTable *atom_to_virtual;
/* Session Management leader window see ICCCM */
Window leader_window;
GdkWindow *leader_gdk_window;
gboolean leader_window_title_set;
/* list of filters for client messages */
GList *client_filters;
/* List of functions to go from extension event => X window */
GSList *event_types;
/* X ID hashtable */
GHashTable *xid_ht;
/* translation queue */
GQueue *translate_queue;
/* Input device */
/* input GdkDevice list */
GList *input_devices;
/* input GdkWindow list */
GList *input_windows;
gint input_ignore_core;
/* information about network port and host for gxid daemon */
gchar *input_gxid_host;
gint input_gxid_port;
/* Startup notification */
gchar *startup_notification_id;
/* Time of most recent user interaction. */
gulong user_time;
/* Sets of atoms for DND */
guint base_dnd_atoms_precached : 1;
guint xdnd_atoms_precached : 1;
guint motif_atoms_precached : 1;
guint use_sync : 1;
guint have_shapes : 1;
guint have_input_shapes : 1;
/* Alpha mask picture format */
XRenderPictFormat *mask_format;
};
从GDKDisplay 到GDKScreen
GdkWindow *
gdk_screen_get_root_window (GdkScreen *screen)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
return GDK_SCREEN_X11 (screen)->root_window;
}
现在到了rootwindow了
struct _GdkDrawable
{
GObject parent_instance;
};
void
gdk_drawable_get_size (GdkDrawable *drawable,
gint *width,
gint *height)
{
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
GDK_DRAWABLE_GET_CLASS (drawable)->get_size (drawable, width, height);
}
这样就获取了宽和高
pixbuf = gdk_pixbuf_get_from_drawable (NULL,
root_window,
gdk_drawable_get_colormap (root_window),
0, 0,
0, 0,
width, height);
ret = gdk_pixbuf_save (pixbuf, filename, "png", error, NULL);
g_object_unref (pixbuf);
生成一个文件就OK了
相关文章推荐
- 8/27/2011 2:53:01 AM
- 8/27/2011 3:02:21 AM
- 8/27/2011 3:28:33 AM
- 8/27/2011 3:37:16 AM
- 8/27/2011 3:41:56 AM
- 8/27/2011 3:44:57 AM
- 8/27/2011 3:49:00 AM
- 8/27/2011 4:00:02 AM
- 2011_10_27单片机(三)
- 2011_11_27_mp3项目
- 6/21/2011 9:11:39 AM
- 8/19/2011 10:40:41 AM
- SCRUM Beta Day 5 5/27/2011
- 6/30/2011 10:27:55 AM
- 第一次写微博2011-07-27
- Dynamics CRM 2011 编程系列(27):使用触发器
- 6/17/2011 9:22:03 AM
- 6/27/2011 2:55:30 PM
- 9/6/2011 10:06:34 AM
- 2011 4-27 KMP 算法