40
40
#ifdef HAVE_X11_EXTENSIONS_SHAPE_H
41
41
#include <X11/extensions/shape.h>
42
#endif /* HAVE_X11_EXTENSIONS_SHAPE_H */
44
44
#ifdef HAVE_X11_XMU_WINUTIL_H
45
45
#include <X11/Xmu/WinUtil.h>
46
#endif /* HAVE_X11_XMU_WINUTIL_H */
49
#include <X11/extensions/Xfixes.h>
48
52
#elif defined(GDK_WINDOWING_WIN32)
49
53
#include <windows.h>
251
257
G_N_ELEMENTS (return_vals),
252
258
args, return_vals);
254
gimp_plugin_menu_register (PLUG_IN_PROC, "<Toolbox>/File/Acquire");
255
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/File/Acquire");
260
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/File/Create/Acquire");
256
261
gimp_plugin_icon_register (PLUG_IN_PROC, GIMP_ICON_TYPE_INLINE_PIXBUF,
257
262
screenshot_icon);
827
add_cursor_image (gint32 image,
831
XFixesCursorImage *cursor;
832
GimpDrawable *drawable;
838
cursor = XFixesGetCursorImage (GDK_DISPLAY_XDISPLAY (display));
843
active = gimp_image_get_active_layer (image);
845
layer = gimp_layer_new (image, _("Mouse Pointer"),
846
cursor->width, cursor->height,
847
GIMP_RGBA_IMAGE, 100.0, GIMP_NORMAL_MODE);
849
drawable = gimp_drawable_get (layer);
851
gimp_pixel_rgn_init (&rgn, drawable,
852
0, 0, drawable->width, drawable->height, TRUE, FALSE);
854
for (pr = gimp_pixel_rgns_register (1, &rgn);
856
pr = gimp_pixel_rgns_process (pr))
858
const gulong *src = cursor->pixels + rgn.y * cursor->width + rgn.x;
859
guchar *dest = rgn.data;
862
for (y = 0; y < rgn.h; y++)
864
const gulong *s = src;
867
for (x = 0; x < rgn.w; x++)
869
/* the cursor pixels are pre-multiplied ARGB */
870
guint a = (*s >> 24) & 0xff;
871
guint r = (*s >> 16) & 0xff;
872
guint g = (*s >> 8) & 0xff;
873
guint b = (*s >> 0) & 0xff;
875
d[0] = a ? (r * 255) / a : r;
876
d[1] = a ? (g * 255) / a : g;
877
d[2] = a ? (b * 255) / a : b;
884
src += cursor->width;
885
dest += rgn.rowstride;
889
gimp_drawable_detach (drawable);
891
gimp_image_add_layer (image, layer, -1);
892
gimp_layer_set_offsets (layer,
893
cursor->x - cursor->xhot, cursor->y - cursor->yhot);
895
gimp_image_set_active_layer (image, active);
822
900
/* The main Screenshot function */
1038
1121
_("Take a screenshot of "
1039
1122
"a single _window"));
1040
1123
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
1041
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
1042
shootvals.shoot_type == SHOOT_WINDOW);
1043
1124
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
1044
1125
gtk_widget_show (button);
1070
1151
#endif /* HAVE_X11_XMU_WINUTIL_H */
1153
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
1154
shootvals.shoot_type == SHOOT_WINDOW);
1073
1156
/* whole screen */
1074
1157
button = gtk_radio_button_new_with_mnemonic (radio_group,
1075
1158
_("Take a screenshot of "
1076
1159
"the entire _screen"));
1077
1160
radio_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
1161
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
1162
gtk_widget_show (button);
1164
g_object_set_data (G_OBJECT (button), "gimp-item-data",
1165
GINT_TO_POINTER (SHOOT_ROOT));
1167
g_signal_connect (button, "toggled",
1168
G_CALLBACK (shoot_radio_button_toggled),
1173
hbox = gtk_hbox_new (FALSE, 12);
1174
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
1175
gtk_widget_show (hbox);
1177
toggle = gtk_check_button_new_with_mnemonic (_("Include _mouse pointer"));
1178
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
1179
shootvals.show_cursor);
1180
gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 24);
1181
gtk_widget_show (toggle);
1183
gtk_widget_set_sensitive (toggle, FALSE);
1184
g_object_set_data (G_OBJECT (button), "set_sensitive", toggle);
1186
g_signal_connect (toggle, "toggled",
1187
G_CALLBACK (gimp_toggle_button_update),
1188
&shootvals.show_cursor);
1078
1192
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
1079
1193
shootvals.shoot_type == SHOOT_ROOT);
1080
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
1081
gtk_widget_show (button);
1083
g_object_set_data (G_OBJECT (button), "gimp-item-data",
1084
GINT_TO_POINTER (SHOOT_ROOT));
1086
g_signal_connect (button, "toggled",
1087
G_CALLBACK (shoot_radio_button_toggled),
1090
1195
/* dragged region */
1091
1196
button = gtk_radio_button_new_with_mnemonic (radio_group,