~ubuntu-branches/ubuntu/vivid/cairo-dock-plug-ins/vivid

« back to all changes in this revision

Viewing changes to Screenshot/src/applet-screenshot.c

  • Committer: Matthieu Baerts
  • Date: 2013-08-27 14:46:47 UTC
  • mto: (53.1.4 cairo-dock-plug-ins)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: matttbe@gmail.com-20130827144647-wm0kyawa8vcg0cso
Tags: upstream-3.2.99.beta1.1~20130827~bzr2928
ImportĀ upstreamĀ versionĀ 3.2.99.beta1.1~20130827~bzr2928

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <time.h>
23
23
 
24
24
#include <cairo-xlib.h>
 
25
#include <gdk/gdkx.h>
25
26
 
26
27
#include "applet-struct.h"
27
28
#include "applet-screenshot.h"
34
35
 /// DRAWING ///
35
36
///////////////
36
37
 
37
 
static gboolean _render_step_cairo (Icon *pIcon, CairoDockModuleInstance *myApplet)
 
38
static gboolean _render_step_cairo (Icon *pIcon, GldiModuleInstance *myApplet)
38
39
{
39
40
        CD_APPLET_ENTER;
40
41
        double f = CD_APPLET_GET_TRANSITION_FRACTION ();
63
64
        CD_APPLET_LEAVE (TRUE);
64
65
}
65
66
 
66
 
static gboolean _render_step_opengl (Icon *pIcon, CairoDockModuleInstance *myApplet)
 
67
static gboolean _render_step_opengl (Icon *pIcon, GldiModuleInstance *myApplet)
67
68
{
68
69
        g_return_val_if_fail (myData.pCurrentImage != NULL, FALSE);
69
70
        CD_APPLET_ENTER;
98
99
 /// MENU ///
99
100
////////////
100
101
 
101
 
void cd_screenshot_free_apps_list (CairoDockModuleInstance *myApplet)
 
102
void cd_screenshot_free_apps_list (GldiModuleInstance *myApplet)
102
103
{
103
104
        if (myData.pAppList != NULL)
104
105
        {
185
186
static gchar *_make_screenshot (gboolean bActiveWindow, const gchar *cFolder, const gchar *cFileName)
186
187
{
187
188
        // create a surface that points on the root window.
188
 
        Display *display = cairo_dock_get_Xdisplay ();
 
189
        Display *display = gdk_x11_get_default_xdisplay ();
189
190
        Screen *screen = XDefaultScreenOfDisplay (display);
190
191
        Visual *visual = DefaultVisualOfScreen (screen);
191
192
        int w, h;
192
193
        Window Xid;
193
194
        if (bActiveWindow)
194
195
        {
195
 
                Xid = cairo_dock_get_current_active_window();
 
196
                GldiWindowActor *pActiveWindow = gldi_windows_get_active ();
 
197
                Xid = gldi_window_get_id (pActiveWindow);  // cairo_dock_get_active_xwindow ()
196
198
                Window root_return;
197
199
                int x_return=1, y_return=1;
198
200
                unsigned int width_return, height_return, border_width_return, depth_return;
200
202
                        &root_return,
201
203
                        &x_return, &y_return,
202
204
                        &width_return, &height_return,
203
 
                        &border_width_return, &depth_return);  // we can't use the data from the Task manager, because it takes into account the window border.
 
205
                        &border_width_return, &depth_return);  // we can't use the data from the WindowActor, because it takes into account the window border.
204
206
                w = width_return;
205
207
                h = height_return;
206
208
        }
207
209
        else
208
210
        {
209
 
                Xid = cairo_dock_get_root_id();
 
211
                Xid = DefaultRootWindow (display);
210
212
                w = g_desktopGeometry.Xscreen.width;
211
213
                h = g_desktopGeometry.Xscreen.height;
212
214
        }
233
235
                int h0 = h * ratio;
234
236
                cairo_surface_t *pSurface = cairo_dock_duplicate_surface (s,
235
237
                        w, h,
236
 
                        w0, h0);  // we must duplicate the surface, because it's an Xlib surface, not an data surface (plus it's way too large anyway).
 
238
                        w0, h0);  // we must duplicate the surface, because it's an Xlib surface, not a data surface (plus it's way too large anyway).
237
239
                cairo_dock_load_image_buffer_from_surface (myData.pCurrentImage, pSurface, w0, h0);
238
240
                
239
241
                cairo_dock_free_image_buffer (myData.pOldImage);
328
330
        }
329
331
        else  // show an error message
330
332
        {
331
 
                cairo_dock_show_temporary_dialog_with_icon (D_("Unable to take a screenshot"), myIcon, myContainer, 7000, MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
 
333
                gldi_dialog_show_temporary_with_icon (D_("Unable to take a screenshot"), myIcon, myContainer, 7000, MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE);
332
334
        }
333
335
}
334
336
 
403
405
        gtk_box_pack_start (GTK_BOX (pBox), pHBox, FALSE, FALSE, _MARGIN);
404
406
        
405
407
        GtkWidget *pLabel = gtk_label_new (cLabel);
406
 
        cairo_dock_set_dialog_widget_text_color (pLabel);
 
408
        gldi_dialog_set_widget_text_color (pLabel);
407
409
        gtk_box_pack_start (GTK_BOX (pHBox), pLabel, FALSE, FALSE, _MARGIN);
408
410
 
409
411
        gtk_widget_set_tooltip_text (pLabel, cTooltip);
468
470
        #endif
469
471
        gtk_scale_set_digits (GTK_SCALE (pScale), 0);
470
472
        g_object_set (pScale, "width-request", 100, NULL);
471
 
        cairo_dock_set_dialog_widget_text_color (pScale);
 
473
        gldi_dialog_set_widget_text_color (pScale);
472
474
        gtk_box_pack_end (GTK_BOX (pHBox), pScale, FALSE, FALSE, _MARGIN);
473
475
        g_object_set_data (G_OBJECT (pBox), "delay", pScale);
474
476
        gtk_widget_set_tooltip_text (pScale, cTooltip);