2012-11-30 06:38:34 -08:00
|
|
|
/**
|
|
|
|
* @addtogroup Optional_Look
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @defgroup Module_Shot Screenshot
|
|
|
|
*
|
|
|
|
* Takes screen shots and can submit them to http://enlightenment.org
|
|
|
|
*
|
|
|
|
* @}
|
|
|
|
*/
|
2019-12-18 11:01:40 -08:00
|
|
|
#include "e_mod_main.h"
|
2015-07-08 12:12:44 -07:00
|
|
|
|
2019-12-18 11:01:40 -08:00
|
|
|
E_Module *shot_module = NULL;
|
2011-05-27 23:53:44 -07:00
|
|
|
|
2020-01-03 14:03:57 -08:00
|
|
|
static E_Action *border_act = NULL, *delay_act = NULL, *act = NULL;
|
2011-05-27 23:53:44 -07:00
|
|
|
static E_Int_Menu_Augmentation *maug = NULL;
|
2020-01-03 14:03:57 -08:00
|
|
|
static Ecore_Timer *timer = NULL, *border_timer = NULL;
|
2017-07-21 13:20:03 -07:00
|
|
|
static Evas_Object *snap = NULL;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
static E_Client_Menu_Hook *border_hook = NULL;
|
2020-01-03 14:03:57 -08:00
|
|
|
static E_Object_Delfn *delfn_client = NULL;
|
|
|
|
static E_Object_Delfn *delfn_zone = NULL;
|
2011-05-27 23:53:44 -07:00
|
|
|
|
2017-07-21 13:20:03 -07:00
|
|
|
static E_Client *shot_ec = NULL;
|
|
|
|
static E_Zone *shot_zone = NULL;
|
|
|
|
static char *shot_params;
|
2015-07-08 12:12:44 -07:00
|
|
|
|
2020-01-03 14:03:57 -08:00
|
|
|
static void
|
|
|
|
_cb_client_del(void *data EINA_UNUSED, void *obj EINA_UNUSED)
|
|
|
|
{
|
|
|
|
if (delfn_client)
|
|
|
|
{
|
|
|
|
e_object_delfn_del(E_OBJECT(shot_ec), delfn_client);
|
|
|
|
delfn_client = NULL;
|
|
|
|
}
|
|
|
|
if (delfn_zone)
|
|
|
|
{
|
|
|
|
e_object_delfn_del(E_OBJECT(shot_zone), delfn_zone);
|
|
|
|
delfn_zone = NULL;
|
|
|
|
}
|
|
|
|
if (timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(timer);
|
|
|
|
timer = NULL;
|
|
|
|
}
|
|
|
|
if (border_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(border_timer);
|
|
|
|
border_timer = NULL;
|
|
|
|
}
|
|
|
|
E_FREE_FUNC(snap, evas_object_del);
|
|
|
|
E_FREE(shot_params);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_cb_zone_del(void *data, void *obj)
|
|
|
|
{
|
|
|
|
_cb_client_del(data, obj);
|
|
|
|
}
|
|
|
|
|
2015-07-08 12:12:44 -07:00
|
|
|
static void
|
2017-07-21 13:20:03 -07:00
|
|
|
_shot_post(void *buffer EINA_UNUSED, Evas *e EINA_UNUSED, void *event EINA_UNUSED)
|
2015-07-08 12:12:44 -07:00
|
|
|
{
|
shot tmp.
shot - add shot editor with arbitrary cropping and drawing tools
We don't need padded vs other shot of window now as u can remove the
padding with a single click in the editor now, so remove that (comment
it out).
The editor allows you to click on each screen, on a window (and click
again on a window to remove the padding area for the crop so its
snugly around the window).
You can zoom in and out and scroll around.
You can add lines with an arrow, double-arrowed lines, plain lines
with no arrows, some clipart (e-logo, mallocs, pointing finger... just
having some fun) and some fun "text boxes" like though bubbles,
speecvh bubbles, just plain text with a darking outline, a plain
entry-styled text box and you can select the colors for the text and
background area as well.
It's inksape-like in that the items you draw are objects that can then
be modified or deleted. modifying them raises them and places some
controls on/over/around the object.
And you can still save and share the results.
Fun times!
@feat
2019-12-28 14:02:39 -08:00
|
|
|
int x, y, w, h;
|
|
|
|
evas_object_geometry_get(snap, &x, &y, &w, &h);
|
2017-07-21 13:20:03 -07:00
|
|
|
evas_event_callback_del(e_comp->evas, EVAS_CALLBACK_RENDER_POST, _shot_post);
|
2019-12-18 11:01:40 -08:00
|
|
|
preview_dialog_show(shot_zone, shot_ec, shot_params,
|
shot tmp.
shot - add shot editor with arbitrary cropping and drawing tools
We don't need padded vs other shot of window now as u can remove the
padding with a single click in the editor now, so remove that (comment
it out).
The editor allows you to click on each screen, on a window (and click
again on a window to remove the padding area for the crop so its
snugly around the window).
You can zoom in and out and scroll around.
You can add lines with an arrow, double-arrowed lines, plain lines
with no arrows, some clipart (e-logo, mallocs, pointing finger... just
having some fun) and some fun "text boxes" like though bubbles,
speecvh bubbles, just plain text with a darking outline, a plain
entry-styled text box and you can select the colors for the text and
background area as well.
It's inksape-like in that the items you draw are objects that can then
be modified or deleted. modifying them raises them and places some
controls on/over/around the object.
And you can still save and share the results.
Fun times!
@feat
2019-12-28 14:02:39 -08:00
|
|
|
(void *)evas_object_image_data_get(snap, 0),
|
|
|
|
x, y, w, h);
|
2017-07-21 13:20:03 -07:00
|
|
|
E_FREE_FUNC(snap, evas_object_del);
|
2020-01-03 14:03:57 -08:00
|
|
|
if (delfn_client)
|
|
|
|
{
|
|
|
|
e_object_delfn_del(E_OBJECT(shot_ec), delfn_client);
|
|
|
|
delfn_client = NULL;
|
|
|
|
}
|
|
|
|
if (delfn_zone)
|
|
|
|
{
|
|
|
|
e_object_delfn_del(E_OBJECT(shot_zone), delfn_zone);
|
|
|
|
delfn_zone = NULL;
|
|
|
|
}
|
2017-07-21 13:20:03 -07:00
|
|
|
shot_ec = NULL;
|
|
|
|
shot_zone = NULL;
|
|
|
|
E_FREE(shot_params);
|
2015-07-08 12:12:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-07-21 13:20:03 -07:00
|
|
|
_shot_now(E_Zone *zone, E_Client *ec, const char *params)
|
2015-07-08 12:12:44 -07:00
|
|
|
{
|
|
|
|
int x, y, w, h;
|
2020-01-04 08:06:17 -08:00
|
|
|
if (preview_have() || share_have() || (snap)) return;
|
2015-07-08 12:12:44 -07:00
|
|
|
if ((!zone) && (!ec)) return;
|
|
|
|
if (zone)
|
|
|
|
{
|
2017-07-21 13:20:03 -07:00
|
|
|
w = e_comp->w;
|
|
|
|
h = e_comp->h;
|
2015-07-08 12:12:44 -07:00
|
|
|
x = y = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-11-03 00:16:45 -07:00
|
|
|
int pad = 0;
|
|
|
|
|
|
|
|
if (params)
|
|
|
|
{
|
|
|
|
const char *p = strstr(params, "pad ");
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
pad = atoi(p + 4);
|
|
|
|
if (pad < 0) pad = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
x = ec->x - pad;
|
|
|
|
y = ec->y - pad;
|
|
|
|
w = ec->w + (pad * 2);
|
|
|
|
h = ec->h + (pad * 2);
|
2017-07-21 13:20:03 -07:00
|
|
|
x = E_CLAMP(x, 0, e_comp->w);
|
|
|
|
y = E_CLAMP(y, 0, e_comp->h);
|
|
|
|
w = E_CLAMP(w, 1, e_comp->w);
|
|
|
|
h = E_CLAMP(h, 1, e_comp->h);
|
2015-07-08 12:12:44 -07:00
|
|
|
}
|
2017-07-21 13:20:03 -07:00
|
|
|
if (eina_streq(ecore_evas_engine_name_get(e_comp->ee), "buffer"))
|
2015-07-08 12:12:44 -07:00
|
|
|
{
|
2019-12-18 11:01:40 -08:00
|
|
|
preview_dialog_show(zone, ec, params,
|
|
|
|
(void *)ecore_evas_buffer_pixels_get(e_comp->ee),
|
shot tmp.
shot - add shot editor with arbitrary cropping and drawing tools
We don't need padded vs other shot of window now as u can remove the
padding with a single click in the editor now, so remove that (comment
it out).
The editor allows you to click on each screen, on a window (and click
again on a window to remove the padding area for the crop so its
snugly around the window).
You can zoom in and out and scroll around.
You can add lines with an arrow, double-arrowed lines, plain lines
with no arrows, some clipart (e-logo, mallocs, pointing finger... just
having some fun) and some fun "text boxes" like though bubbles,
speecvh bubbles, just plain text with a darking outline, a plain
entry-styled text box and you can select the colors for the text and
background area as well.
It's inksape-like in that the items you draw are objects that can then
be modified or deleted. modifying them raises them and places some
controls on/over/around the object.
And you can still save and share the results.
Fun times!
@feat
2019-12-28 14:02:39 -08:00
|
|
|
x, y, w, h);
|
2020-01-03 14:03:57 -08:00
|
|
|
if (delfn_client)
|
|
|
|
{
|
|
|
|
e_object_delfn_del(E_OBJECT(ec), delfn_client);
|
|
|
|
delfn_client = NULL;
|
|
|
|
}
|
|
|
|
if (delfn_zone)
|
|
|
|
{
|
|
|
|
e_object_delfn_del(E_OBJECT(zone), delfn_zone);
|
|
|
|
delfn_zone = NULL;
|
|
|
|
}
|
2015-07-08 12:12:44 -07:00
|
|
|
return;
|
|
|
|
}
|
2017-07-21 13:20:03 -07:00
|
|
|
shot_ec = ec;
|
|
|
|
shot_zone = zone;
|
|
|
|
shot_params = eina_strdup(params);
|
|
|
|
snap = evas_object_image_filled_add(e_comp->evas);
|
|
|
|
evas_object_pass_events_set(snap, 1);
|
|
|
|
evas_object_layer_set(snap, EVAS_LAYER_MAX);
|
|
|
|
evas_object_image_snapshot_set(snap, 1);
|
|
|
|
evas_object_geometry_set(snap, x, y, w, h);
|
|
|
|
evas_object_show(snap);
|
|
|
|
evas_object_image_data_update_add(snap, 0, 0, w, h);
|
|
|
|
evas_object_image_pixels_dirty_set(snap, 1);
|
|
|
|
evas_event_callback_add(e_comp->evas, EVAS_CALLBACK_RENDER_POST, _shot_post, snap);
|
|
|
|
ecore_evas_manual_render(e_comp->ee);
|
2015-07-08 12:12:44 -07:00
|
|
|
}
|
|
|
|
|
2011-05-27 23:53:44 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_shot_delay(void *data)
|
|
|
|
{
|
|
|
|
timer = NULL;
|
2017-07-21 13:20:03 -07:00
|
|
|
_shot_now(data, NULL, NULL);
|
2012-07-19 03:02:26 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2015-07-08 12:12:44 -07:00
|
|
|
|
2017-11-03 00:16:45 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_shot_delay_border_padded(void *data)
|
|
|
|
{
|
|
|
|
char buf[128];
|
|
|
|
|
|
|
|
border_timer = NULL;
|
2020-01-03 14:03:57 -08:00
|
|
|
snprintf(buf, sizeof(buf), "pad %i", (int)(ELM_SCALE_SIZE(64)));
|
2017-11-03 00:16:45 -07:00
|
|
|
_shot_now(NULL, data, buf);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2020-01-04 05:47:15 -08:00
|
|
|
|
2017-11-03 00:16:45 -07:00
|
|
|
static void
|
|
|
|
_shot_border_padded(E_Client *ec)
|
|
|
|
{
|
|
|
|
if (border_timer) ecore_timer_del(border_timer);
|
|
|
|
border_timer = ecore_timer_loop_add(1.0, _shot_delay_border_padded, ec);
|
2020-01-03 14:03:57 -08:00
|
|
|
delfn_client = e_object_delfn_add(E_OBJECT(ec), _cb_client_del, NULL);
|
2017-11-03 00:16:45 -07:00
|
|
|
}
|
|
|
|
|
2011-05-27 23:53:44 -07:00
|
|
|
static void
|
|
|
|
_shot(E_Zone *zone)
|
|
|
|
{
|
|
|
|
if (timer) ecore_timer_del(timer);
|
2017-02-03 13:52:28 -08:00
|
|
|
timer = ecore_timer_loop_add(1.0, _shot_delay, zone);
|
2020-01-03 14:03:57 -08:00
|
|
|
delfn_zone = e_object_delfn_add(E_OBJECT(zone), _cb_zone_del, NULL);
|
2011-05-27 23:53:44 -07:00
|
|
|
}
|
2020-01-04 05:47:15 -08:00
|
|
|
|
2017-11-03 00:16:45 -07:00
|
|
|
static void
|
|
|
|
_e_mod_menu_border_padded_cb(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_shot_border_padded(data);
|
|
|
|
}
|
|
|
|
|
2011-05-27 23:53:44 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_mod_menu_cb(void *data EINA_UNUSED, E_Menu *m, E_Menu_Item *mi EINA_UNUSED)
|
2011-05-27 23:53:44 -07:00
|
|
|
{
|
|
|
|
if (m->zone) _shot(m->zone);
|
|
|
|
}
|
|
|
|
|
2012-07-19 03:02:26 -07:00
|
|
|
static void
|
2017-11-03 00:16:45 -07:00
|
|
|
_e_mod_action_border_cb(E_Object *obj EINA_UNUSED, const char *params)
|
2012-07-19 03:02:26 -07:00
|
|
|
{
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
E_Client *ec;
|
2015-07-06 06:37:52 -07:00
|
|
|
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
ec = e_client_focused_get();
|
|
|
|
if (!ec) return;
|
2012-07-19 03:02:26 -07:00
|
|
|
if (border_timer)
|
2014-07-01 03:51:04 -07:00
|
|
|
{
|
|
|
|
ecore_timer_del(border_timer);
|
|
|
|
border_timer = NULL;
|
|
|
|
}
|
2017-11-03 00:16:45 -07:00
|
|
|
_shot_now(NULL, ec, params);
|
2012-07-19 03:02:26 -07:00
|
|
|
}
|
|
|
|
|
2016-01-22 13:23:21 -08:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
E_Zone *zone;
|
|
|
|
char *params;
|
|
|
|
} Delayed_Shot;
|
|
|
|
|
|
|
|
static void
|
|
|
|
_delayed_shot(void *data)
|
|
|
|
{
|
|
|
|
Delayed_Shot *ds = data;
|
|
|
|
|
2017-07-21 13:20:03 -07:00
|
|
|
_shot_now(ds->zone, NULL, ds->params);
|
2016-01-22 13:23:21 -08:00
|
|
|
e_object_unref(E_OBJECT(ds->zone));
|
|
|
|
free(ds->params);
|
|
|
|
free(ds);
|
|
|
|
}
|
|
|
|
|
2020-01-04 05:39:05 -08:00
|
|
|
static Eina_Bool
|
2020-01-03 14:03:57 -08:00
|
|
|
_delayed_shot_timer(void *data)
|
|
|
|
{
|
|
|
|
timer = NULL;
|
|
|
|
_delayed_shot(data);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_mod_action_delay_cb(E_Object *obj, const char *params)
|
|
|
|
{
|
|
|
|
E_Zone *zone = NULL;
|
|
|
|
Delayed_Shot *ds;
|
|
|
|
double delay = 0.0;
|
|
|
|
|
|
|
|
if (obj)
|
|
|
|
{
|
|
|
|
if (obj->type == E_COMP_TYPE) zone = e_zone_current_get();
|
|
|
|
else if (obj->type == E_ZONE_TYPE) zone = ((void *)obj);
|
|
|
|
else zone = e_zone_current_get();
|
|
|
|
}
|
|
|
|
if (!zone) zone = e_zone_current_get();
|
|
|
|
if (!zone) return;
|
|
|
|
E_FREE_FUNC(timer, ecore_timer_del);
|
|
|
|
ds = E_NEW(Delayed_Shot, 1);
|
|
|
|
e_object_ref(E_OBJECT(zone));
|
|
|
|
ds->zone = zone;
|
|
|
|
ds->params = params ? strdup(params) : NULL;
|
|
|
|
if (params) delay = (double)atoi(params) / 1000.0;
|
|
|
|
if (timer) ecore_timer_del(timer);
|
|
|
|
timer = ecore_timer_loop_add(delay, _delayed_shot_timer, ds);
|
|
|
|
delfn_zone = e_object_delfn_add(E_OBJECT(zone), _cb_zone_del, NULL);
|
|
|
|
}
|
|
|
|
|
2011-05-27 23:53:44 -07:00
|
|
|
static void
|
2014-01-21 04:21:13 -08:00
|
|
|
_e_mod_action_cb(E_Object *obj, const char *params)
|
2011-05-27 23:53:44 -07:00
|
|
|
{
|
|
|
|
E_Zone *zone = NULL;
|
2016-01-22 13:23:21 -08:00
|
|
|
Delayed_Shot *ds;
|
2014-07-01 03:51:04 -07:00
|
|
|
|
2011-05-27 23:53:44 -07:00
|
|
|
if (obj)
|
|
|
|
{
|
2019-12-18 11:01:40 -08:00
|
|
|
if (obj->type == E_COMP_TYPE) zone = e_zone_current_get();
|
|
|
|
else if (obj->type == E_ZONE_TYPE) zone = ((void *)obj);
|
|
|
|
else zone = e_zone_current_get();
|
2011-05-27 23:53:44 -07:00
|
|
|
}
|
2015-03-13 14:47:36 -07:00
|
|
|
if (!zone) zone = e_zone_current_get();
|
2011-05-27 23:53:44 -07:00
|
|
|
if (!zone) return;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
E_FREE_FUNC(timer, ecore_timer_del);
|
2016-01-22 13:23:21 -08:00
|
|
|
ds = E_NEW(Delayed_Shot, 1);
|
|
|
|
e_object_ref(E_OBJECT(zone));
|
|
|
|
ds->zone = zone;
|
|
|
|
ds->params = params ? strdup(params) : NULL;
|
2019-12-18 11:01:40 -08:00
|
|
|
// forced main loop iteration in screenshots causes bugs if the action
|
|
|
|
// executes immediately
|
2016-01-22 13:23:21 -08:00
|
|
|
ecore_job_add(_delayed_shot, ds);
|
2012-07-19 03:02:26 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_bd_hook(void *d EINA_UNUSED, E_Client *ec)
|
2012-07-19 03:02:26 -07:00
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
E_Menu *m;
|
|
|
|
Eina_List *l;
|
2015-07-06 06:37:52 -07:00
|
|
|
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
if (!ec->border_menu) return;
|
|
|
|
if (ec->iconic || (ec->desk != e_desk_current_get(ec->zone))) return;
|
|
|
|
m = ec->border_menu;
|
2012-07-19 03:02:26 -07:00
|
|
|
|
2019-12-18 11:01:40 -08:00
|
|
|
// position menu item just before first separator
|
2012-07-19 03:02:26 -07:00
|
|
|
EINA_LIST_FOREACH(m->items, l, mi)
|
2019-12-18 11:01:40 -08:00
|
|
|
{
|
|
|
|
if (mi->separator) break;
|
|
|
|
}
|
2012-07-19 03:02:26 -07:00
|
|
|
if ((!mi) || (!mi->separator)) return;
|
|
|
|
l = eina_list_prev(l);
|
|
|
|
mi = eina_list_data_get(l);
|
|
|
|
if (!mi) return;
|
|
|
|
|
|
|
|
mi = e_menu_item_new_relative(m, mi);
|
|
|
|
e_menu_item_label_set(mi, _("Take Shot"));
|
|
|
|
e_util_menu_item_theme_icon_set(mi, "screenshot");
|
2017-11-03 00:16:45 -07:00
|
|
|
e_menu_item_callback_set(mi, _e_mod_menu_border_padded_cb, ec);
|
2011-05-27 23:53:44 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_mod_menu_add(void *data EINA_UNUSED, E_Menu *m)
|
2011-05-27 23:53:44 -07:00
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
2014-07-01 03:51:04 -07:00
|
|
|
|
2011-05-27 23:53:44 -07:00
|
|
|
mi = e_menu_item_new(m);
|
|
|
|
e_menu_item_label_set(mi, _("Take Screenshot"));
|
|
|
|
e_util_menu_item_theme_icon_set(mi, "screenshot");
|
|
|
|
e_menu_item_callback_set(mi, _e_mod_menu_cb, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* module setup */
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Module_Api e_modapi =
|
2011-05-27 23:53:44 -07:00
|
|
|
{
|
|
|
|
E_MODULE_API_VERSION,
|
|
|
|
"Shot"
|
|
|
|
};
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void *
|
2011-05-27 23:53:44 -07:00
|
|
|
e_modapi_init(E_Module *m)
|
|
|
|
{
|
2012-11-12 02:28:00 -08:00
|
|
|
if (!ecore_con_url_init())
|
|
|
|
{
|
|
|
|
e_util_dialog_show(_("Shot Error"),
|
|
|
|
_("Cannot initialize network"));
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-07-01 03:51:04 -07:00
|
|
|
|
2011-05-27 23:53:44 -07:00
|
|
|
shot_module = m;
|
|
|
|
act = e_action_add("shot");
|
|
|
|
if (act)
|
|
|
|
{
|
|
|
|
act->func.go = _e_mod_action_cb;
|
2012-12-16 08:58:17 -08:00
|
|
|
e_action_predef_name_set(N_("Screen"), N_("Take Screenshot"),
|
2014-01-21 04:21:13 -08:00
|
|
|
"shot", NULL,
|
2015-01-15 02:43:24 -08:00
|
|
|
"syntax: [share|save [perfect|high|medium|low|QUALITY current|all|SCREEN-NUM]", 1);
|
2011-05-27 23:53:44 -07:00
|
|
|
}
|
2020-01-03 14:03:57 -08:00
|
|
|
delay_act = e_action_add("shot_delay");
|
|
|
|
if (delay_act)
|
|
|
|
{
|
|
|
|
delay_act->func.go = _e_mod_action_delay_cb;
|
|
|
|
e_action_predef_name_set(N_("Screen"), N_("Take Screenshot with Delay"),
|
|
|
|
"shot_delay", NULL,
|
|
|
|
"syntax: delay_ms (e.g. 3000)", 1);
|
|
|
|
}
|
2012-07-19 03:02:26 -07:00
|
|
|
border_act = e_action_add("border_shot");
|
|
|
|
if (border_act)
|
|
|
|
{
|
|
|
|
border_act->func.go = _e_mod_action_border_cb;
|
2012-12-16 08:58:17 -08:00
|
|
|
e_action_predef_name_set(N_("Window : Actions"), N_("Take Shot"),
|
2014-01-21 04:21:13 -08:00
|
|
|
"border_shot", NULL,
|
2017-11-03 00:16:45 -07:00
|
|
|
"syntax: [share|save perfect|high|medium|low|QUALITY all|current] [pad N]", 1);
|
2012-07-19 03:02:26 -07:00
|
|
|
}
|
2011-05-27 23:53:44 -07:00
|
|
|
maug = e_int_menus_menu_augmentation_add_sorted
|
2014-07-01 03:51:04 -07:00
|
|
|
("main/2", _("Take Screenshot"), _e_mod_menu_add, NULL, NULL, NULL);
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
border_hook = e_int_client_menu_hook_add(_bd_hook, NULL);
|
2015-07-08 12:12:44 -07:00
|
|
|
|
2011-05-27 23:53:44 -07:00
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
2011-05-27 23:53:44 -07:00
|
|
|
{
|
2019-12-18 11:01:40 -08:00
|
|
|
share_abort();
|
|
|
|
preview_abort();
|
2020-01-03 14:03:57 -08:00
|
|
|
delay_abort();
|
|
|
|
if (delfn_client)
|
|
|
|
{
|
|
|
|
e_object_delfn_del(E_OBJECT(shot_ec), delfn_client);
|
|
|
|
delfn_client = NULL;
|
|
|
|
}
|
|
|
|
if (delfn_zone)
|
|
|
|
{
|
|
|
|
e_object_delfn_del(E_OBJECT(shot_zone), delfn_zone);
|
|
|
|
delfn_zone = NULL;
|
|
|
|
}
|
2011-05-27 23:53:44 -07:00
|
|
|
if (timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(timer);
|
|
|
|
timer = NULL;
|
|
|
|
}
|
2020-01-03 14:03:57 -08:00
|
|
|
if (border_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(border_timer);
|
|
|
|
border_timer = NULL;
|
|
|
|
}
|
|
|
|
E_FREE_FUNC(snap, evas_object_del);
|
|
|
|
E_FREE(shot_params);
|
2011-05-27 23:53:44 -07:00
|
|
|
if (maug)
|
|
|
|
{
|
|
|
|
e_int_menus_menu_augmentation_del("main/2", maug);
|
|
|
|
maug = NULL;
|
|
|
|
}
|
|
|
|
if (act)
|
|
|
|
{
|
2012-12-16 08:58:17 -08:00
|
|
|
e_action_predef_name_del("Screen", "Take Screenshot");
|
2011-05-27 23:53:44 -07:00
|
|
|
e_action_del("shot");
|
|
|
|
act = NULL;
|
|
|
|
}
|
2017-07-21 13:20:03 -07:00
|
|
|
|
2011-05-27 23:53:44 -07:00
|
|
|
shot_module = NULL;
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
e_int_client_menu_hook_del(border_hook);
|
2012-11-12 02:28:00 -08:00
|
|
|
ecore_con_url_shutdown();
|
2011-05-27 23:53:44 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
e_modapi_save(E_Module *m EINA_UNUSED)
|
2011-05-27 23:53:44 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|