2012-05-02 01:20:53 -07:00
|
|
|
#include "e_mod_tiling.h"
|
|
|
|
|
2014-05-06 06:22:01 -07:00
|
|
|
/* There are two major concepts, (un)track and add/remove client.
|
|
|
|
* track - track all windows regardless if we are interested in them or not.
|
|
|
|
* We need that in order to keep proper track of things as they change.
|
|
|
|
* add/remove: Clients should be tiled/untiled.
|
|
|
|
*/
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
/* types {{{ */
|
|
|
|
|
2014-05-06 07:44:35 -07:00
|
|
|
#define TILING_POPUP_TIMEOUT 0.8
|
|
|
|
#define TILING_POPUP_SIZE 100
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-07-29 21:51:03 -07:00
|
|
|
static Eina_Bool started = EINA_FALSE;
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
typedef struct geom_t
|
|
|
|
{
|
|
|
|
int x, y, w, h;
|
2012-05-02 01:20:53 -07:00
|
|
|
} geom_t;
|
|
|
|
|
2017-03-09 02:14:44 -08:00
|
|
|
typedef enum {
|
|
|
|
POSITION_TOP = 0,
|
|
|
|
POSITION_RIGHT = 1,
|
|
|
|
POSITION_BOTTOM = 2,
|
|
|
|
POSITION_LEFT = 3
|
|
|
|
} Position_On_Client;
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
typedef struct Client_Extra
|
|
|
|
{
|
|
|
|
E_Client *client;
|
2014-02-10 01:27:57 -08:00
|
|
|
geom_t expected;
|
2014-02-04 08:24:44 -08:00
|
|
|
struct
|
2017-03-13 14:26:37 -07:00
|
|
|
{
|
2017-03-21 12:42:52 -07:00
|
|
|
Eina_Bool drag;
|
|
|
|
Evas_Object *hint, *ic;
|
2017-03-13 14:26:37 -07:00
|
|
|
Ecore_Event_Handler *move, *up;
|
|
|
|
int x,y; /* start points */
|
|
|
|
} drag;
|
|
|
|
struct
|
2014-02-04 08:24:44 -08:00
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
geom_t geom;
|
|
|
|
E_Maximize maximized;
|
2014-02-04 08:24:44 -08:00
|
|
|
const char *bordername;
|
|
|
|
} orig;
|
2014-02-10 01:27:57 -08:00
|
|
|
int last_frame_adjustment; // FIXME: Hack for frame resize bug.
|
2017-11-08 06:22:24 -08:00
|
|
|
Eina_Bool floating E_BITFIELD;
|
|
|
|
Eina_Bool tiled E_BITFIELD;
|
|
|
|
Eina_Bool tracked E_BITFIELD;
|
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
|
|
|
} Client_Extra;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-06 08:06:32 -08:00
|
|
|
typedef struct _Instance
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
E_Gadcon_Client *gcc;
|
|
|
|
Evas_Object *gadget;
|
2014-02-06 08:06:32 -08:00
|
|
|
Eina_Stringshare *gad_id;
|
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
E_Menu *lmenu;
|
2014-02-06 08:06:32 -08:00
|
|
|
} Instance;
|
|
|
|
|
2017-03-09 14:06:23 -08:00
|
|
|
typedef struct {
|
|
|
|
E_Desk *desk;
|
|
|
|
Tiling_Split_Type type;
|
|
|
|
} Desk_Split_Type;
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
struct tiling_g tiling_g = {
|
2014-02-04 08:24:44 -08:00
|
|
|
.module = NULL,
|
|
|
|
.config = NULL,
|
|
|
|
.log_domain = -1,
|
2012-05-02 01:20:53 -07:00
|
|
|
};
|
|
|
|
|
2014-05-06 06:22:01 -07:00
|
|
|
static void _client_track(E_Client *ec);
|
|
|
|
static void _client_untrack(E_Client *ec);
|
2017-02-21 10:49:55 -08:00
|
|
|
static Eina_Bool _add_client(E_Client *ec, Tiling_Split_Type type);
|
2014-02-10 01:27:57 -08:00
|
|
|
static void _remove_client(E_Client *ec);
|
2014-02-12 04:32:57 -08:00
|
|
|
static void _client_apply_settings(E_Client *ec, Client_Extra *extra);
|
2014-02-10 01:27:57 -08:00
|
|
|
static void _foreach_desk(void (*func)(E_Desk *desk));
|
2014-02-20 07:44:38 -08:00
|
|
|
static Eina_Bool _toggle_tiling_based_on_state(E_Client *ec, Eina_Bool restore);
|
2014-05-06 07:44:35 -07:00
|
|
|
static void _edje_tiling_icon_set(Evas_Object *o);
|
2014-08-20 03:00:34 -07:00
|
|
|
static void _desk_config_apply(E_Desk *d, int old_nb_stacks, int new_nb_stacks);
|
2017-03-10 03:04:38 -08:00
|
|
|
static void _update_current_desk(E_Desk *new);
|
2017-03-10 04:49:58 -08:00
|
|
|
static void _client_drag_terminate(E_Client *ec);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-06 08:06:32 -08:00
|
|
|
/* Func Proto Requirements for Gadcon */
|
|
|
|
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
2014-02-10 01:27:57 -08:00
|
|
|
static void _gc_shutdown(E_Gadcon_Client *gcc);
|
|
|
|
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
|
|
|
|
|
|
|
static const char *_gc_label(const E_Gadcon_Client_Class *client_class EINA_UNUSED);
|
2014-02-06 08:06:32 -08:00
|
|
|
static Evas_Object *_gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas *evas);
|
2014-02-10 01:27:57 -08:00
|
|
|
static const char *_gc_id_new(const E_Gadcon_Client_Class *client_class EINA_UNUSED);
|
2014-02-06 08:06:32 -08:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
static void _gadget_icon_set(Instance *inst);
|
2014-02-06 08:06:32 -08:00
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
/* }}} */
|
|
|
|
/* Globals {{{ */
|
|
|
|
|
|
|
|
static struct tiling_mod_main_g
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
char edj_path[PATH_MAX];
|
|
|
|
E_Config_DD *config_edd, *vdesk_edd;
|
2014-02-04 08:24:44 -08:00
|
|
|
Ecore_Event_Handler *handler_client_resize, *handler_client_move,
|
2014-05-19 01:46:05 -07:00
|
|
|
*handler_client_iconify, *handler_client_uniconify,
|
2017-03-09 02:14:44 -08:00
|
|
|
*handler_desk_set, *handler_compositor_resize,
|
2017-03-13 14:26:37 -07:00
|
|
|
*handler_desk_show;
|
2017-03-09 02:14:44 -08:00
|
|
|
E_Client_Hook *handler_client_resize_begin, *handler_client_add,
|
|
|
|
*handler_move_begin, *handler_move_end;
|
2014-02-10 01:27:57 -08:00
|
|
|
E_Client_Menu_Hook *client_menu_hook;
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
Tiling_Info *tinfo;
|
|
|
|
Eina_Hash *info_hash;
|
|
|
|
Eina_Hash *client_extras;
|
2017-03-09 14:06:23 -08:00
|
|
|
Eina_Hash *desk_type;
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
E_Action *act_togglefloat, *act_move_up, *act_move_down, *act_move_left,
|
|
|
|
*act_move_right, *act_toggle_split_mode, *act_swap_window;
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2017-03-09 14:06:23 -08:00
|
|
|
Desk_Split_Type *current_split_type;
|
2014-05-06 07:44:35 -07:00
|
|
|
|
|
|
|
struct {
|
|
|
|
Evas_Object *comp_obj;
|
|
|
|
Evas_Object *obj;
|
|
|
|
Ecore_Timer *timer;
|
2016-09-06 07:31:13 -07:00
|
|
|
E_Desk *desk;
|
2014-05-06 07:44:35 -07:00
|
|
|
} split_popup;
|
2014-02-04 08:24:44 -08:00
|
|
|
} _G =
|
|
|
|
{
|
2017-03-09 14:06:23 -08:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
};
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-06 08:06:32 -08:00
|
|
|
/* Define the class and gadcon functions this module provides */
|
|
|
|
static const E_Gadcon_Client_Class _gc_class =
|
|
|
|
{
|
|
|
|
GADCON_CLIENT_CLASS_VERSION, "tiling",
|
|
|
|
{ _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new,
|
2014-02-10 01:27:57 -08:00
|
|
|
NULL, NULL },
|
2014-02-06 08:06:32 -08:00
|
|
|
E_GADCON_CLIENT_STYLE_PLAIN
|
|
|
|
};
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
/* }}} */
|
|
|
|
/* Utils {{{ */
|
|
|
|
|
|
|
|
/* I wonder why noone has implemented the following one yet? */
|
|
|
|
static E_Desk *
|
|
|
|
get_current_desk(void)
|
|
|
|
{
|
2015-03-13 14:19:17 -07:00
|
|
|
E_Zone *z = e_zone_current_get();
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return e_desk_current_get(z);
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2017-02-21 10:49:55 -08:00
|
|
|
static Tiling_Split_Type
|
2017-03-09 14:06:23 -08:00
|
|
|
_current_tiled_state(Eina_Bool allow_float)
|
2017-02-21 10:49:55 -08:00
|
|
|
{
|
2017-03-10 03:04:38 -08:00
|
|
|
//update the current desk in case something has changed it
|
|
|
|
_update_current_desk(get_current_desk());
|
|
|
|
|
2017-03-09 14:06:23 -08:00
|
|
|
if (!_G.current_split_type)
|
|
|
|
{
|
|
|
|
ERR("Invalid state, the current field can never be NULL");
|
|
|
|
return TILING_SPLIT_HORIZONTAL;
|
|
|
|
}
|
2017-02-21 10:49:55 -08:00
|
|
|
|
2017-03-09 14:06:23 -08:00
|
|
|
if (!allow_float &&
|
|
|
|
_G.current_split_type->type == TILING_SPLIT_FLOAT)
|
2017-02-21 10:49:55 -08:00
|
|
|
return TILING_SPLIT_HORIZONTAL;
|
2017-03-09 14:06:23 -08:00
|
|
|
return _G.current_split_type->type;
|
2017-02-21 10:49:55 -08:00
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
static Tiling_Info *
|
2014-02-10 01:27:57 -08:00
|
|
|
_initialize_tinfo(const E_Desk *desk)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
Tiling_Info *tinfo;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
tinfo = E_NEW(Tiling_Info, 1);
|
|
|
|
tinfo->desk = desk;
|
|
|
|
eina_hash_direct_add(_G.info_hash, &tinfo->desk, tinfo);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
tinfo->conf =
|
2014-02-10 01:27:57 -08:00
|
|
|
get_vdesk(tiling_g.config->vdesks, desk->x, desk->y, desk->zone->num);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return tinfo;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
check_tinfo(const E_Desk *desk)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-03-04 22:27:15 -08:00
|
|
|
if (!desk) return;
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!_G.tinfo || _G.tinfo->desk != desk)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
_G.tinfo = eina_hash_find(_G.info_hash, &desk);
|
|
|
|
if (!_G.tinfo)
|
|
|
|
{
|
|
|
|
/* lazy init */
|
|
|
|
_G.tinfo = _initialize_tinfo(desk);
|
|
|
|
}
|
|
|
|
if (!_G.tinfo->conf)
|
|
|
|
{
|
|
|
|
_G.tinfo->conf =
|
|
|
|
get_vdesk(tiling_g.config->vdesks, desk->x, desk->y,
|
|
|
|
desk->zone->num);
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-01-13 08:31:56 -08:00
|
|
|
static Eina_Bool
|
2014-02-10 01:27:57 -08:00
|
|
|
desk_should_tile_check(const E_Desk *desk)
|
2014-01-13 08:31:56 -08:00
|
|
|
{
|
|
|
|
check_tinfo(desk);
|
2014-02-10 01:27:57 -08:00
|
|
|
return _G.tinfo && _G.tinfo->conf && _G.tinfo->conf->nb_stacks;
|
2014-01-13 08:31:56 -08:00
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
static int
|
2014-02-10 01:27:57 -08:00
|
|
|
is_ignored_window(const Client_Extra *extra)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-20 06:56:27 -08:00
|
|
|
if (extra->client->sticky || extra->client->maximized ||
|
|
|
|
extra->client->fullscreen || extra->floating)
|
2014-02-10 01:27:57 -08:00
|
|
|
return true;
|
2014-01-16 04:27:34 -08:00
|
|
|
|
|
|
|
return false;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2014-02-10 01:27:57 -08:00
|
|
|
is_tilable(const E_Client *ec)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
if (ec->icccm.min_h == ec->icccm.max_h && ec->icccm.max_h > 0)
|
2014-02-10 01:27:57 -08:00
|
|
|
return false;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2015-04-13 03:17:25 -07:00
|
|
|
if (ec->e.state.centered || e_win_centered_get(ec->internal_elm_win))
|
2014-02-10 01:27:57 -08:00
|
|
|
return false;
|
2014-01-14 07:29:27 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!tiling_g.config->tile_dialogs && ((ec->icccm.transient_for != 0) ||
|
2014-02-10 01:27:57 -08:00
|
|
|
(ec->netwm.type == E_WINDOW_TYPE_DIALOG)))
|
|
|
|
return false;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (ec->fullscreen)
|
2014-02-20 06:59:12 -08:00
|
|
|
return false;
|
|
|
|
|
|
|
|
if (ec->maximized)
|
|
|
|
return false;
|
2014-01-13 09:23:33 -08:00
|
|
|
|
2014-02-18 07:22:47 -08:00
|
|
|
if (ec->iconic)
|
|
|
|
return false;
|
|
|
|
|
2014-02-20 07:04:59 -08:00
|
|
|
if (ec->sticky)
|
|
|
|
return false;
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (e_client_util_ignored_get(ec))
|
2014-02-10 01:27:57 -08:00
|
|
|
return false;
|
2014-01-20 07:25:00 -08:00
|
|
|
|
2014-06-03 04:49:10 -07:00
|
|
|
if (e_object_is_del(E_OBJECT(ec)))
|
|
|
|
return false;
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return true;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
change_window_border(E_Client *ec, const char *bordername)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2015-01-04 05:45:16 -08:00
|
|
|
if (ec->mwm.borderless)
|
|
|
|
return;
|
|
|
|
|
2014-07-28 05:16:45 -07:00
|
|
|
ec->border.changed = 0;
|
2014-07-28 05:32:24 -07:00
|
|
|
if (e_client_border_set(ec, bordername))
|
|
|
|
eina_stringshare_refplace(&ec->bordername, ec->border.name);
|
2012-06-21 01:30:51 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
DBG("%p -> border %s", ec, bordername);
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2014-02-10 01:27:57 -08:00
|
|
|
_info_hash_update(const Eina_Hash *hash EINA_UNUSED,
|
|
|
|
const void *key EINA_UNUSED, void *data, void *fdata EINA_UNUSED)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
Tiling_Info *tinfo = data;
|
2014-08-20 03:00:34 -07:00
|
|
|
int old_nb_stacks = 0, new_nb_stacks = 0;
|
|
|
|
|
|
|
|
if (tinfo->conf)
|
|
|
|
{
|
|
|
|
old_nb_stacks = tinfo->conf->nb_stacks;
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
|
|
|
|
if (tinfo->desk)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
tinfo->conf =
|
|
|
|
get_vdesk(tiling_g.config->vdesks, tinfo->desk->x, tinfo->desk->y,
|
|
|
|
tinfo->desk->zone->num);
|
2014-08-20 03:00:34 -07:00
|
|
|
|
|
|
|
if (tinfo->conf)
|
|
|
|
{
|
|
|
|
new_nb_stacks = tinfo->conf->nb_stacks;
|
|
|
|
}
|
|
|
|
|
|
|
|
_desk_config_apply((E_Desk *) tinfo->desk, old_nb_stacks, new_nb_stacks);
|
2014-02-10 01:27:57 -08:00
|
|
|
}
|
|
|
|
else
|
2014-02-04 08:24:44 -08:00
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
tinfo->conf = NULL;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return true;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_tiling_update_conf(void)
|
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
eina_hash_foreach(_G.info_hash, _info_hash_update, NULL);
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_client_move_resize(E_Client *ec, int x, int y, int w, int h)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
Client_Extra *extra;
|
2014-01-15 05:03:16 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
extra = eina_hash_find(_G.client_extras, &ec);
|
|
|
|
if (!extra)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
ERR("No extra for %p", ec);
|
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-01-15 05:03:16 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
extra->last_frame_adjustment =
|
2014-02-10 01:27:57 -08:00
|
|
|
MAX(ec->h - ec->client.h, ec->w - ec->client.w);
|
2014-02-04 08:24:44 -08:00
|
|
|
DBG("%p -> %dx%d+%d+%d", ec, w, h, x, y);
|
|
|
|
evas_object_geometry_set(ec->frame, x, y, w, h);
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_client_unmaximize(E_Client *ec, E_Maximize max)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
DBG("%p -> %s", ec,
|
|
|
|
(max & E_MAXIMIZE_DIRECTION) ==
|
|
|
|
E_MAXIMIZE_NONE ? "NONE" : (max & E_MAXIMIZE_DIRECTION) ==
|
|
|
|
E_MAXIMIZE_VERTICAL ? "VERTICAL" : (max & E_MAXIMIZE_DIRECTION) ==
|
|
|
|
E_MAXIMIZE_HORIZONTAL ? "HORIZONTAL" : "BOTH");
|
|
|
|
e_client_unmaximize(ec, max);
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-02-20 06:41:59 -08:00
|
|
|
static Client_Extra *
|
2014-02-20 07:32:25 -08:00
|
|
|
_restore_client(E_Client *ec)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
Client_Extra *extra;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
extra = eina_hash_find(_G.client_extras, &ec);
|
|
|
|
if (!extra)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
ERR("No extra for %p", ec);
|
2014-02-20 06:41:59 -08:00
|
|
|
return NULL;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-02-12 03:34:48 -08:00
|
|
|
|
|
|
|
if (!extra->tiled)
|
2014-02-20 06:41:59 -08:00
|
|
|
return NULL;
|
|
|
|
|
2014-02-20 07:31:14 -08:00
|
|
|
if (!ec->maximized && !ec->fullscreen)
|
2014-02-04 08:24:44 -08:00
|
|
|
{
|
2014-02-20 07:31:14 -08:00
|
|
|
_e_client_move_resize(ec, extra->orig.geom.x, extra->orig.geom.y,
|
|
|
|
extra->orig.geom.w, extra->orig.geom.h);
|
|
|
|
if (extra->orig.maximized != ec->maximized)
|
|
|
|
{
|
|
|
|
e_client_maximize(ec, extra->orig.maximized);
|
|
|
|
ec->maximized = extra->orig.maximized;
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-02-20 07:32:25 -08:00
|
|
|
|
|
|
|
DBG("Change window border back to %s for %p", extra->orig.bordername, ec);
|
|
|
|
change_window_border(ec,
|
|
|
|
(extra->orig.bordername) ? extra->orig.bordername : "default");
|
|
|
|
|
|
|
|
return extra;
|
2012-05-02 01:20:53 -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
|
|
|
static Client_Extra *
|
2014-02-10 01:27:57 -08:00
|
|
|
_get_or_create_client_extra(E_Client *ec)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
Client_Extra *extra;
|
|
|
|
|
|
|
|
extra = eina_hash_find(_G.client_extras, &ec);
|
|
|
|
if (!extra)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
extra = E_NEW(Client_Extra, 1);
|
|
|
|
*extra = (Client_Extra)
|
|
|
|
{
|
|
|
|
.client = ec, .expected =
|
|
|
|
{
|
|
|
|
.x = ec->x, .y = ec->y, .w = ec->w, .h = ec->h,
|
|
|
|
}
|
|
|
|
|
|
|
|
, .orig =
|
|
|
|
{
|
|
|
|
.geom =
|
|
|
|
{
|
|
|
|
.x = ec->x, .y = ec->y, .w = ec->w, .h = ec->h,
|
|
|
|
}
|
|
|
|
|
|
|
|
, .maximized = ec->maximized, .bordername =
|
|
|
|
eina_stringshare_add(ec->bordername),
|
|
|
|
}
|
|
|
|
|
|
|
|
,
|
|
|
|
};
|
|
|
|
eina_hash_direct_add(_G.client_extras, &extra->client, extra);
|
|
|
|
}
|
|
|
|
else
|
2014-02-04 08:24:44 -08:00
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
extra->expected = (geom_t)
|
|
|
|
{
|
|
|
|
.x = ec->x, .y = ec->y, .w = ec->w, .h = ec->h,
|
|
|
|
};
|
|
|
|
extra->orig.geom = extra->expected;
|
|
|
|
extra->orig.maximized = ec->maximized;
|
|
|
|
eina_stringshare_replace(&extra->orig.bordername, ec->bordername);
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return extra;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-01-14 07:07:30 -08:00
|
|
|
void
|
2014-02-10 01:27:57 -08:00
|
|
|
tiling_e_client_move_resize_extra(E_Client *ec, int x, int y, int w, int h)
|
2014-01-14 07:07:30 -08:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
|
|
|
|
|
|
|
if (!extra)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
ERR("No extra for %p", ec);
|
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-01-14 09:25:32 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
extra->expected = (geom_t)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
.x = x, .y = y, .w = w, .h = h,
|
|
|
|
};
|
2014-01-14 07:07:30 -08:00
|
|
|
|
|
|
|
_e_client_move_resize(ec, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
2014-01-20 07:49:36 -08:00
|
|
|
static Client_Extra *
|
2014-02-12 04:20:56 -08:00
|
|
|
tiling_entry_no_desk_func(E_Client *ec)
|
2014-01-20 07:49:36 -08:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!ec)
|
2014-02-10 01:27:57 -08:00
|
|
|
return NULL;
|
2014-01-20 07:49:36 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
2014-01-20 07:49:36 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!extra)
|
2014-02-10 01:27:57 -08:00
|
|
|
ERR("No extra for %p", ec);
|
2014-01-20 07:49:36 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return extra;
|
2014-01-20 07:49:36 -08:00
|
|
|
}
|
|
|
|
|
2014-02-12 04:20:56 -08:00
|
|
|
static Client_Extra *
|
|
|
|
tiling_entry_func(E_Client *ec)
|
|
|
|
{
|
2014-07-28 02:41:54 -07:00
|
|
|
Client_Extra *extra;
|
|
|
|
|
|
|
|
if (!is_tilable(ec))
|
|
|
|
return NULL;
|
2014-07-27 13:58:58 -07:00
|
|
|
|
2014-07-28 02:41:54 -07:00
|
|
|
extra = tiling_entry_no_desk_func(ec);
|
2014-02-12 04:20:56 -08:00
|
|
|
|
|
|
|
if (!extra)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (!desk_should_tile_check(ec->desk))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return extra;
|
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
/* }}} */
|
2014-02-04 08:24:44 -08:00
|
|
|
/* Reorganize Stacks {{{ */
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-01-13 06:53:26 -08:00
|
|
|
static void
|
|
|
|
_reapply_tree(void)
|
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
int zx, zy, zw, zh;
|
2014-01-13 06:53:26 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (_G.tinfo->tree)
|
|
|
|
{
|
2014-07-28 17:39:34 -07:00
|
|
|
e_zone_desk_useful_geometry_get(_G.tinfo->desk->zone, _G.tinfo->desk, &zx, &zy, &zw, &zh);
|
2014-01-13 06:53:26 -08:00
|
|
|
|
2017-03-31 07:33:05 -07:00
|
|
|
if (zw > 0 && zh > 0)
|
|
|
|
tiling_window_tree_apply(_G.tinfo->tree, zx, zy, zw, zh,
|
|
|
|
tiling_g.config->window_padding);
|
|
|
|
else
|
2018-01-04 06:57:21 -08:00
|
|
|
ERR("The zone desk geometry was not useful at all (%d,%d,%d,%d)", zx, zy, zw, zh);
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-01-13 06:53:26 -08:00
|
|
|
}
|
|
|
|
|
2014-01-13 09:28:57 -08:00
|
|
|
void
|
2014-01-17 08:24:53 -08:00
|
|
|
_restore_free_client(void *_item)
|
2014-01-13 09:28:57 -08:00
|
|
|
{
|
2014-01-17 08:24:53 -08:00
|
|
|
Window_Tree *item = _item;
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2014-01-17 08:24:53 -08:00
|
|
|
if (item->client)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
_restore_client(item->client);
|
2014-02-12 03:34:48 -08:00
|
|
|
|
|
|
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &item->client);
|
|
|
|
|
|
|
|
if (extra)
|
|
|
|
{
|
|
|
|
extra->tiled = EINA_FALSE;
|
|
|
|
}
|
2014-01-17 08:24:53 -08:00
|
|
|
}
|
|
|
|
free(item);
|
2014-01-13 09:28:57 -08:00
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
void
|
|
|
|
change_desk_conf(struct _Config_vdesk *newconf)
|
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
E_Zone *z;
|
|
|
|
E_Desk *d;
|
2014-02-12 04:32:57 -08:00
|
|
|
int old_nb_stacks, new_nb_stacks = newconf->nb_stacks;
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2015-03-13 12:54:51 -07:00
|
|
|
z = e_comp_zone_number_get(newconf->zone_num);
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!z)
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
d = e_desk_at_xy_get(z, newconf->x, newconf->y);
|
|
|
|
if (!d)
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
check_tinfo(d);
|
2014-02-12 04:32:57 -08:00
|
|
|
old_nb_stacks = _G.tinfo->conf->nb_stacks;
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
_G.tinfo->conf = newconf;
|
2014-02-12 03:34:48 -08:00
|
|
|
_G.tinfo->conf->nb_stacks = new_nb_stacks;
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2014-08-20 03:00:34 -07:00
|
|
|
_desk_config_apply(d, old_nb_stacks, new_nb_stacks);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_desk_config_apply(E_Desk *d, int old_nb_stacks, int new_nb_stacks)
|
|
|
|
{
|
|
|
|
check_tinfo(d);
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (new_nb_stacks == 0)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
tiling_window_tree_walk(_G.tinfo->tree, _restore_free_client);
|
|
|
|
_G.tinfo->tree = NULL;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-02-12 04:32:57 -08:00
|
|
|
else if (new_nb_stacks == old_nb_stacks)
|
|
|
|
{
|
|
|
|
E_Client *ec;
|
|
|
|
|
2015-03-13 12:45:07 -07:00
|
|
|
E_CLIENT_FOREACH(ec)
|
2014-02-12 04:32:57 -08:00
|
|
|
{
|
|
|
|
_client_apply_settings(ec, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
_reapply_tree();
|
|
|
|
}
|
2014-02-12 03:34:48 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Add all the existing windows. */
|
|
|
|
E_Client *ec;
|
|
|
|
|
2015-03-13 12:45:07 -07:00
|
|
|
E_CLIENT_FOREACH(ec)
|
2014-02-12 03:34:48 -08:00
|
|
|
{
|
2017-03-09 14:06:23 -08:00
|
|
|
_add_client(ec, _current_tiled_state(EINA_TRUE));
|
2014-02-12 03:34:48 -08:00
|
|
|
}
|
2014-08-20 03:00:34 -07:00
|
|
|
|
|
|
|
_reapply_tree();
|
2014-02-12 03:34:48 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* }}} */
|
2014-02-04 08:24:44 -08:00
|
|
|
/* Reorganize windows {{{ */
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-12 04:32:57 -08:00
|
|
|
static void
|
|
|
|
_client_apply_settings(E_Client *ec, Client_Extra *extra)
|
|
|
|
{
|
|
|
|
if (!extra)
|
|
|
|
{
|
|
|
|
extra = tiling_entry_func(ec);
|
|
|
|
}
|
|
|
|
|
2014-02-20 07:49:33 -08:00
|
|
|
if (!extra || !extra->tiled)
|
2014-02-12 04:32:57 -08:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (ec->maximized)
|
|
|
|
_e_client_unmaximize(ec, E_MAXIMIZE_BOTH);
|
|
|
|
|
|
|
|
if (!tiling_g.config->show_titles && (!ec->bordername ||
|
|
|
|
strcmp(ec->bordername, "pixel")))
|
|
|
|
change_window_border(ec, "pixel");
|
|
|
|
else if (tiling_g.config->show_titles && (ec->bordername &&
|
|
|
|
!strcmp(ec->bordername, "pixel")))
|
2014-02-12 04:34:38 -08:00
|
|
|
change_window_border(ec, (extra->orig.bordername) ? extra->orig.bordername : "default");
|
2014-02-12 04:32:57 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
static void
|
2014-03-20 09:10:24 -07:00
|
|
|
_e_client_check_based_on_state_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|
|
|
void *event_info EINA_UNUSED)
|
|
|
|
{
|
|
|
|
E_Client *ec = data;
|
|
|
|
_toggle_tiling_based_on_state(ec, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
2017-02-24 09:18:37 -08:00
|
|
|
/**
|
|
|
|
* Find the next tiled client under the current coordinates
|
|
|
|
*/
|
|
|
|
static Window_Tree*
|
|
|
|
_tilable_client(int x, int y)
|
|
|
|
{
|
|
|
|
E_Client *ec;
|
|
|
|
|
|
|
|
E_CLIENT_FOREACH(ec)
|
|
|
|
{
|
|
|
|
Eina_Rectangle c;
|
|
|
|
Window_Tree *wt;
|
|
|
|
|
|
|
|
e_client_geometry_get(ec, &c.x, &c.y, &c.w, &c.h);
|
|
|
|
|
|
|
|
if (!eina_rectangle_coords_inside(&c, x, y)) continue;
|
|
|
|
|
|
|
|
if (!(wt = tiling_window_tree_client_find(_G.tinfo->tree, ec))) continue;
|
|
|
|
|
|
|
|
return wt;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-03-09 02:14:44 -08:00
|
|
|
static Position_On_Client
|
|
|
|
_calculate_position_preference(E_Client *ec)
|
|
|
|
{
|
|
|
|
int x,y;
|
|
|
|
float bounded_x, bounded_y;
|
|
|
|
Eina_Rectangle rect;
|
|
|
|
evas_pointer_canvas_xy_get(e_comp->evas, &x, &y);
|
|
|
|
|
2017-03-10 04:49:58 -08:00
|
|
|
e_client_geometry_get(ec, &rect.x, &rect.y, &rect.w, &rect.h);
|
2017-03-09 02:14:44 -08:00
|
|
|
|
2017-03-10 04:49:58 -08:00
|
|
|
if (!eina_rectangle_coords_inside(&rect, x, y))
|
2017-03-09 02:14:44 -08:00
|
|
|
{
|
|
|
|
ERR("Coorinates are not in there");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//for the calculation we think of a X cross in the rectangle
|
|
|
|
bounded_x = ((float)x - rect.x)/((float)rect.w);
|
|
|
|
bounded_y = ((float)y - rect.y)/((float)rect.h);
|
|
|
|
|
|
|
|
if (bounded_y < bounded_x)
|
|
|
|
{
|
|
|
|
//right upper part
|
|
|
|
if (bounded_y < (1.0 - bounded_x))
|
|
|
|
{
|
|
|
|
//left upper
|
|
|
|
return POSITION_TOP;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//right lower
|
|
|
|
return POSITION_RIGHT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//lower left part
|
|
|
|
if (bounded_y < (1.0 - bounded_x))
|
|
|
|
{
|
|
|
|
//left upper
|
|
|
|
return POSITION_LEFT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//right lower
|
|
|
|
return POSITION_BOTTOM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_insert_client_prefered(E_Client *ec)
|
|
|
|
{
|
|
|
|
Window_Tree *parent;
|
|
|
|
Tiling_Split_Type type = TILING_SPLIT_VERTICAL;
|
|
|
|
Eina_Bool before;
|
|
|
|
int x,y;
|
|
|
|
|
|
|
|
evas_pointer_canvas_xy_get(e_comp->evas, &x, &y);
|
|
|
|
parent = _tilable_client(x,y);
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
{
|
|
|
|
//calculate a good position where we would like to stay
|
|
|
|
Position_On_Client c;
|
|
|
|
|
|
|
|
c = _calculate_position_preference(parent->client);
|
|
|
|
if (c == POSITION_TOP || c == POSITION_BOTTOM)
|
|
|
|
{
|
|
|
|
before = (c == POSITION_TOP);
|
|
|
|
type = TILING_SPLIT_VERTICAL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
before = (c == POSITION_LEFT);
|
|
|
|
type = TILING_SPLIT_HORIZONTAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
_G.tinfo->tree = tiling_window_tree_insert(_G.tinfo->tree, parent, ec, type, before);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-08-12 13:26:32 -07:00
|
|
|
_G.tinfo->tree = tiling_window_tree_insert(_G.tinfo->tree, NULL, ec, _current_tiled_state(EINA_FALSE), EINA_FALSE);
|
2017-03-09 02:14:44 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-24 09:18:37 -08:00
|
|
|
static void
|
|
|
|
_insert_client(E_Client *ec, Tiling_Split_Type type)
|
|
|
|
{
|
|
|
|
E_Client *ec_focused = e_client_focused_get();
|
|
|
|
Window_Tree *place = NULL;
|
|
|
|
|
|
|
|
if (ec_focused == ec)
|
|
|
|
{
|
2017-03-09 02:14:44 -08:00
|
|
|
_insert_client_prefered(ec);
|
2017-02-24 09:18:37 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//otherwise place next to the given client
|
|
|
|
place = tiling_window_tree_client_find(_G.tinfo->tree,
|
|
|
|
ec_focused);
|
2017-08-12 08:24:26 -07:00
|
|
|
_G.tinfo->tree = tiling_window_tree_insert(_G.tinfo->tree, place, ec, type, EINA_FALSE);
|
2017-02-24 09:18:37 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-03-20 09:10:24 -07:00
|
|
|
static Eina_Bool
|
2017-02-21 10:49:55 -08:00
|
|
|
_add_client(E_Client *ec, Tiling_Split_Type type)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
/* Should I need to check that the client is not already added? */
|
|
|
|
if (!ec)
|
|
|
|
{
|
2014-03-20 09:10:24 -07:00
|
|
|
return EINA_FALSE;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-05-06 06:22:01 -07:00
|
|
|
|
|
|
|
Client_Extra *extra = _get_or_create_client_extra(ec);
|
|
|
|
_client_track(ec);
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!is_tilable(ec))
|
|
|
|
{
|
2014-03-20 09:10:24 -07:00
|
|
|
return EINA_FALSE;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!desk_should_tile_check(ec->desk))
|
2014-03-20 09:10:24 -07:00
|
|
|
return EINA_FALSE;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (is_ignored_window(extra))
|
2014-03-20 09:10:24 -07:00
|
|
|
return EINA_FALSE;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2017-02-21 10:49:55 -08:00
|
|
|
if (type == TILING_SPLIT_FLOAT)
|
2014-02-04 08:24:44 -08:00
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
extra->floating = EINA_TRUE;
|
2014-03-20 09:10:24 -07:00
|
|
|
return EINA_FALSE;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-01-21 06:53:35 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (extra->tiled)
|
2014-03-20 09:10:24 -07:00
|
|
|
return EINA_FALSE;
|
2014-01-17 08:24:53 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
extra->tiled = EINA_TRUE;
|
2014-01-17 08:24:53 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
DBG("adding %p", ec);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-12 04:32:57 -08:00
|
|
|
_client_apply_settings(ec, extra);
|
2014-01-20 08:29:09 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
/* Window tree updating. */
|
2017-02-24 09:18:37 -08:00
|
|
|
_insert_client(ec, type);
|
2014-01-13 06:53:26 -08:00
|
|
|
|
2014-07-29 21:51:03 -07:00
|
|
|
if (started)
|
|
|
|
_reapply_tree();
|
2014-03-20 09:10:24 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-02-13 01:41:47 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_client_remove_no_apply(E_Client *ec)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!ec)
|
2014-02-13 01:41:47 -08:00
|
|
|
return EINA_FALSE;
|
2014-01-16 03:21:14 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
DBG("removing %p", ec);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!extra)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
if (is_tilable(ec))
|
|
|
|
{
|
|
|
|
ERR("No extra for %p", ec);
|
|
|
|
}
|
2014-02-13 01:41:47 -08:00
|
|
|
return EINA_FALSE;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
|
|
|
|
2017-03-21 12:42:52 -07:00
|
|
|
if (extra->drag.drag)
|
|
|
|
{
|
|
|
|
_client_drag_terminate(ec);
|
|
|
|
}
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!extra->tiled)
|
2014-02-13 01:41:47 -08:00
|
|
|
return EINA_FALSE;
|
2014-01-21 06:57:35 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
extra->tiled = EINA_FALSE;
|
2014-01-17 08:24:53 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
/* Window tree updating. */
|
2014-02-13 01:41:47 -08:00
|
|
|
{
|
|
|
|
/* If focused is NULL, it should return the root. */
|
|
|
|
Window_Tree *item = tiling_window_tree_client_find(_G.tinfo->tree, ec);
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2014-02-13 01:41:47 -08:00
|
|
|
if (!item)
|
|
|
|
{
|
|
|
|
ERR("Couldn't find tree item for client %p!", ec);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-13 01:41:47 -08:00
|
|
|
_G.tinfo->tree = tiling_window_tree_remove(_G.tinfo->tree, item);
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2014-02-13 01:41:47 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_remove_client(E_Client *ec)
|
|
|
|
{
|
2014-05-16 02:21:30 -07:00
|
|
|
if (_client_remove_no_apply(ec))
|
|
|
|
_reapply_tree();
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* }}} */
|
|
|
|
/* Toggle Floating {{{ */
|
|
|
|
|
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
toggle_floating(E_Client *ec)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-12 04:20:56 -08:00
|
|
|
Client_Extra *extra = tiling_entry_no_desk_func(ec);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!extra)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
extra->floating = !extra->floating;
|
2014-01-16 04:27:34 -08:00
|
|
|
|
2014-02-12 04:20:56 -08:00
|
|
|
if (!desk_should_tile_check(ec->desk))
|
|
|
|
return;
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
/* This is the new state, act accordingly. */
|
|
|
|
if (extra->floating)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
_restore_client(ec);
|
|
|
|
_remove_client(ec);
|
|
|
|
}
|
|
|
|
else
|
2014-02-04 08:24:44 -08:00
|
|
|
{
|
2017-03-09 14:06:23 -08:00
|
|
|
_add_client(ec, _current_tiled_state(EINA_FALSE));
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-08-28 08:30:17 -07:00
|
|
|
void
|
|
|
|
tiling_e_client_does_not_fit(E_Client *ec)
|
|
|
|
{
|
2017-08-13 09:19:26 -07:00
|
|
|
E_Notification_Notify n;
|
|
|
|
Eina_Strbuf *buf;
|
|
|
|
|
|
|
|
buf = eina_strbuf_new();
|
2017-08-15 01:57:37 -07:00
|
|
|
if (ec->netwm.name)
|
|
|
|
eina_strbuf_append_printf(buf, "Window %s cannot be tiled\n", ec->netwm.name);
|
|
|
|
else
|
|
|
|
eina_strbuf_append(buf, "A Window cannot be tiled\n");
|
2017-08-13 09:19:26 -07:00
|
|
|
|
2017-09-18 15:55:27 -07:00
|
|
|
memset(&n, 0, sizeof(n));
|
2017-08-13 09:19:26 -07:00
|
|
|
n.app_name = _("Tiling");
|
|
|
|
n.icon.icon = "dialog-error";
|
|
|
|
n.summary = _("Window cannot be tiled");
|
|
|
|
n.body = eina_strbuf_string_get(buf);
|
|
|
|
n.timeout = 2000;
|
|
|
|
e_notification_client_send(&n, NULL, NULL);
|
2014-08-28 08:30:17 -07:00
|
|
|
toggle_floating(ec);
|
2017-08-13 09:19:26 -07:00
|
|
|
|
|
|
|
eina_strbuf_string_free(buf);
|
2014-08-28 08:30:17 -07:00
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_mod_action_toggle_floating_cb(E_Object *obj EINA_UNUSED,
|
|
|
|
const char *params EINA_UNUSED)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
toggle_floating(e_client_focused_get());
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-01-23 06:58:49 -08:00
|
|
|
static E_Client *_go_mouse_client = NULL;
|
|
|
|
|
2016-02-03 14:58:34 -08:00
|
|
|
static Eina_Bool
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_mod_action_swap_window_go_mouse(E_Object *obj EINA_UNUSED,
|
|
|
|
const char *params EINA_UNUSED,
|
|
|
|
E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
|
2014-01-23 06:58:49 -08:00
|
|
|
{
|
|
|
|
E_Client *ec = e_client_under_pointer_get(get_current_desk(), NULL);
|
|
|
|
|
|
|
|
Client_Extra *extra = tiling_entry_func(ec);
|
|
|
|
|
2014-02-20 07:49:33 -08:00
|
|
|
if (!extra || !extra->tiled)
|
2016-02-03 14:58:34 -08:00
|
|
|
return EINA_FALSE;
|
2014-01-23 06:58:49 -08:00
|
|
|
|
|
|
|
_go_mouse_client = ec;
|
2016-02-03 14:58:34 -08:00
|
|
|
return EINA_TRUE;
|
2014-01-23 06:58:49 -08:00
|
|
|
}
|
|
|
|
|
2016-02-03 14:58:34 -08:00
|
|
|
static Eina_Bool
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_mod_action_swap_window_end_mouse(E_Object *obj EINA_UNUSED,
|
|
|
|
const char *params EINA_UNUSED,
|
|
|
|
E_Binding_Event_Mouse_Button *ev EINA_UNUSED)
|
2014-01-23 06:58:49 -08:00
|
|
|
{
|
|
|
|
E_Client *ec = e_client_under_pointer_get(get_current_desk(), NULL);
|
|
|
|
E_Client *first_ec = _go_mouse_client;
|
|
|
|
|
|
|
|
_go_mouse_client = NULL;
|
|
|
|
|
|
|
|
if (!first_ec)
|
2016-02-03 14:58:34 -08:00
|
|
|
return EINA_FALSE;
|
2014-01-23 06:58:49 -08:00
|
|
|
|
|
|
|
Client_Extra *extra = tiling_entry_func(ec);
|
|
|
|
|
2014-02-20 07:49:33 -08:00
|
|
|
if (!extra || !extra->tiled)
|
2016-02-03 14:58:34 -08:00
|
|
|
return EINA_FALSE;
|
2014-01-23 06:58:49 -08:00
|
|
|
|
|
|
|
/* XXX: Only support swap on the first desk for now. */
|
|
|
|
if (ec->desk != first_ec->desk)
|
2016-02-03 14:58:34 -08:00
|
|
|
return EINA_FALSE;
|
2014-01-23 06:58:49 -08:00
|
|
|
|
|
|
|
Window_Tree *item, *first_item;
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2014-01-23 06:58:49 -08:00
|
|
|
item = tiling_window_tree_client_find(_G.tinfo->tree, ec);
|
|
|
|
|
|
|
|
if (!item)
|
2016-02-03 14:58:34 -08:00
|
|
|
return EINA_FALSE;
|
2014-01-23 06:58:49 -08:00
|
|
|
|
|
|
|
first_item = tiling_window_tree_client_find(_G.tinfo->tree, first_ec);
|
|
|
|
|
|
|
|
if (!first_item)
|
2016-02-03 14:58:34 -08:00
|
|
|
return EINA_FALSE;
|
2014-01-23 06:58:49 -08:00
|
|
|
|
|
|
|
item->client = first_ec;
|
|
|
|
first_item->client = ec;
|
|
|
|
|
|
|
|
_reapply_tree();
|
2016-02-03 14:58:34 -08:00
|
|
|
return EINA_TRUE;
|
2014-01-23 06:58:49 -08:00
|
|
|
}
|
|
|
|
|
2014-01-16 05:13:04 -08:00
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_mod_menu_border_cb(void *data, E_Menu *m EINA_UNUSED,
|
|
|
|
E_Menu_Item *mi EINA_UNUSED)
|
2014-01-16 05:13:04 -08:00
|
|
|
{
|
|
|
|
E_Client *ec = data;
|
|
|
|
|
|
|
|
toggle_floating(ec);
|
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
/* }}} */
|
2014-01-17 05:51:57 -08:00
|
|
|
/* {{{ Move windows */
|
2012-05-02 01:20:53 -07:00
|
|
|
|
|
|
|
static void
|
2014-10-29 01:10:01 -07:00
|
|
|
_action_move(int cross_edge)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
E_Desk *desk;
|
|
|
|
E_Client *focused_ec;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
desk = get_current_desk();
|
|
|
|
if (!desk)
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
focused_ec = e_client_focused_get();
|
|
|
|
if (!focused_ec || focused_ec->desk != desk)
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!desk_should_tile_check(desk))
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
Window_Tree *item =
|
2014-02-10 01:27:57 -08:00
|
|
|
tiling_window_tree_client_find(_G.tinfo->tree, focused_ec);
|
2014-01-17 05:51:57 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (item)
|
|
|
|
{
|
2014-10-29 01:10:01 -07:00
|
|
|
tiling_window_tree_node_change_pos(item, cross_edge);
|
2014-01-17 05:51:57 -08:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
_reapply_tree();
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-01-17 05:51:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_mod_action_move_left_cb(E_Object *obj EINA_UNUSED,
|
|
|
|
const char *params EINA_UNUSED)
|
2014-01-17 05:51:57 -08:00
|
|
|
{
|
2014-10-29 01:10:01 -07:00
|
|
|
_action_move(TILING_WINDOW_TREE_EDGE_LEFT);
|
2014-01-17 05:51:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_mod_action_move_right_cb(E_Object *obj EINA_UNUSED,
|
|
|
|
const char *params EINA_UNUSED)
|
2014-01-17 05:51:57 -08:00
|
|
|
{
|
2014-10-29 01:10:01 -07:00
|
|
|
_action_move(TILING_WINDOW_TREE_EDGE_RIGHT);
|
2014-01-17 05:51:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_mod_action_move_up_cb(E_Object *obj EINA_UNUSED,
|
|
|
|
const char *params EINA_UNUSED)
|
2014-01-17 05:51:57 -08:00
|
|
|
{
|
2014-10-29 01:10:01 -07:00
|
|
|
_action_move(TILING_WINDOW_TREE_EDGE_TOP);
|
2014-01-17 05:51:57 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_mod_action_move_down_cb(E_Object *obj EINA_UNUSED,
|
|
|
|
const char *params EINA_UNUSED)
|
2014-01-17 05:51:57 -08:00
|
|
|
{
|
2014-10-29 01:10:01 -07:00
|
|
|
_action_move(TILING_WINDOW_TREE_EDGE_BOTTOM);
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* }}} */
|
2014-01-13 08:45:04 -08:00
|
|
|
/* Toggle split mode {{{ */
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-05-06 07:44:35 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_split_type_popup_timer_del_cb(void *data EINA_UNUSED)
|
|
|
|
{
|
|
|
|
evas_object_hide(_G.split_popup.comp_obj);
|
|
|
|
evas_object_del(_G.split_popup.comp_obj);
|
|
|
|
_G.split_popup.comp_obj = NULL;
|
|
|
|
_G.split_popup.obj = NULL;
|
|
|
|
_G.split_popup.timer = NULL;
|
2016-09-06 07:31:13 -07:00
|
|
|
_G.split_popup.desk = NULL;
|
2014-05-06 07:44:35 -07:00
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_tiling_split_type_changed_popup(void)
|
|
|
|
{
|
|
|
|
Evas_Object *comp_obj = _G.split_popup.comp_obj;
|
|
|
|
Evas_Object *o = _G.split_popup.obj;
|
2016-09-06 07:31:13 -07:00
|
|
|
E_Desk *desk = NULL;
|
2014-05-06 07:44:35 -07:00
|
|
|
|
|
|
|
/* If this is not NULL, the rest isn't either. */
|
2016-09-06 07:31:13 -07:00
|
|
|
|
|
|
|
/* check for the current desk we have */
|
|
|
|
if (e_client_focused_get())
|
|
|
|
{
|
|
|
|
E_Client *c;
|
|
|
|
|
|
|
|
c = e_client_focused_get();
|
|
|
|
desk = c->desk;
|
|
|
|
}
|
|
|
|
|
2014-05-06 07:44:35 -07:00
|
|
|
if (!o)
|
|
|
|
{
|
2015-03-13 12:12:20 -07:00
|
|
|
_G.split_popup.obj = o = edje_object_add(e_comp->evas);
|
2014-05-06 07:44:35 -07:00
|
|
|
if (!e_theme_edje_object_set(o, "base/theme/modules/tiling",
|
|
|
|
"modules/tiling/main"))
|
|
|
|
edje_object_file_set(o, _G.edj_path, "modules/tiling/main");
|
|
|
|
evas_object_resize(o, TILING_POPUP_SIZE, TILING_POPUP_SIZE);
|
|
|
|
|
|
|
|
_G.split_popup.comp_obj = comp_obj = e_comp_object_util_add(o, E_COMP_OBJECT_TYPE_POPUP);
|
2016-09-06 07:31:13 -07:00
|
|
|
|
|
|
|
if (desk)
|
|
|
|
e_comp_object_util_center_on_zone(comp_obj, e_zone_current_get());
|
|
|
|
else
|
|
|
|
e_comp_object_util_center(comp_obj);
|
|
|
|
_G.split_popup.desk = desk;
|
2014-05-06 07:44:35 -07:00
|
|
|
evas_object_layer_set(comp_obj, E_LAYER_POPUP);
|
2014-05-06 07:56:38 -07:00
|
|
|
evas_object_pass_events_set(comp_obj, EINA_TRUE);
|
2014-05-06 07:44:35 -07:00
|
|
|
|
|
|
|
evas_object_show(comp_obj);
|
|
|
|
|
2017-02-03 13:52:28 -08:00
|
|
|
_G.split_popup.timer = ecore_timer_loop_add(TILING_POPUP_TIMEOUT, _split_type_popup_timer_del_cb, NULL);
|
2014-05-06 07:44:35 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-09-06 07:31:13 -07:00
|
|
|
if (desk != _G.split_popup.desk)
|
|
|
|
e_comp_object_util_center_on_zone(comp_obj, e_zone_current_get());
|
2017-02-06 13:59:25 -08:00
|
|
|
ecore_timer_loop_reset(_G.split_popup.timer);
|
2014-05-06 07:44:35 -07:00
|
|
|
}
|
|
|
|
|
2016-09-06 07:31:13 -07:00
|
|
|
|
2014-05-06 07:44:35 -07:00
|
|
|
_edje_tiling_icon_set(o);
|
|
|
|
}
|
|
|
|
|
2014-02-06 08:06:32 -08:00
|
|
|
static void
|
2017-03-10 03:04:38 -08:00
|
|
|
_tiling_gadgets_update(void)
|
2014-02-06 08:06:32 -08:00
|
|
|
{
|
|
|
|
Instance *inst;
|
|
|
|
Eina_List *itr;
|
2017-03-09 14:06:23 -08:00
|
|
|
|
2017-03-10 03:04:38 -08:00
|
|
|
EINA_LIST_FOREACH(tiling_g.gadget_instances, itr, inst)
|
|
|
|
{
|
|
|
|
_gadget_icon_set(inst);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_tiling_split_type_next(void)
|
|
|
|
{
|
|
|
|
//update the current desk in case something has changed it
|
|
|
|
_update_current_desk(get_current_desk());
|
|
|
|
|
2017-03-09 14:06:23 -08:00
|
|
|
if (!_G.current_split_type)
|
|
|
|
{
|
|
|
|
ERR("Invalid state, current split type is NULL");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
_G.current_split_type->type = (_G.current_split_type->type + 1) % TILING_SPLIT_LAST;
|
2014-02-06 08:06:32 -08:00
|
|
|
|
2014-02-06 08:57:48 -08:00
|
|
|
/* If we don't allow floating, skip it. */
|
|
|
|
if (!tiling_g.config->have_floating_mode &&
|
2017-03-09 14:06:23 -08:00
|
|
|
(_G.current_split_type->type == TILING_SPLIT_FLOAT))
|
2014-02-06 08:57:48 -08:00
|
|
|
{
|
2017-03-09 14:06:23 -08:00
|
|
|
_G.current_split_type->type = (_G.current_split_type->type + 1) % TILING_SPLIT_LAST;
|
2014-02-06 08:57:48 -08:00
|
|
|
}
|
|
|
|
|
2017-03-10 03:04:38 -08:00
|
|
|
_tiling_gadgets_update();
|
2014-05-06 07:44:35 -07:00
|
|
|
_tiling_split_type_changed_popup();
|
2014-02-06 08:06:32 -08:00
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_e_mod_action_toggle_split_mode(E_Object *obj EINA_UNUSED,
|
|
|
|
const char *params EINA_UNUSED)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-06 08:06:32 -08:00
|
|
|
_tiling_split_type_next();
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* }}} */
|
2014-02-04 08:24:44 -08:00
|
|
|
/* Hooks {{{ */
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_move_or_resize(E_Client *ec)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
Client_Extra *extra = tiling_entry_func(ec);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-20 07:49:33 -08:00
|
|
|
if (!extra || !extra->tiled)
|
2014-02-04 08:24:44 -08:00
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if ((ec->x == extra->expected.x) && (ec->y == extra->expected.y) &&
|
|
|
|
(ec->w == extra->expected.w) && (ec->h == extra->expected.h))
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-01-14 09:25:32 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!extra->last_frame_adjustment)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
printf
|
|
|
|
("This is probably because of the frame adjustment bug. Return\n");
|
|
|
|
_reapply_tree();
|
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-01-15 05:03:16 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
Window_Tree *item = tiling_window_tree_client_find(_G.tinfo->tree, ec);
|
2014-01-14 09:25:32 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!item)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
ERR("Couldn't find tree item for resized client %p!", ec);
|
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-01-14 09:25:32 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
{
|
|
|
|
int w_dir = 1, h_dir = 1;
|
|
|
|
double w_diff = 1.0, h_diff = 1.0;
|
|
|
|
|
|
|
|
if (abs(extra->expected.w - ec->w) >= 1)
|
2014-02-10 01:27:57 -08:00
|
|
|
{
|
|
|
|
w_diff = ((double)ec->w) / extra->expected.w;
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
if (abs(extra->expected.h - ec->h) >= 1)
|
2014-02-10 01:27:57 -08:00
|
|
|
{
|
|
|
|
h_diff = ((double)ec->h) / extra->expected.h;
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
switch (ec->resize_mode)
|
2014-02-10 01:27:57 -08:00
|
|
|
{
|
|
|
|
case E_POINTER_RESIZE_L:
|
|
|
|
case E_POINTER_RESIZE_BL:
|
|
|
|
w_dir = -1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_POINTER_RESIZE_T:
|
|
|
|
case E_POINTER_RESIZE_TR:
|
|
|
|
h_dir = -1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_POINTER_RESIZE_TL:
|
|
|
|
w_dir = -1;
|
|
|
|
h_dir = -1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2017-01-06 21:05:17 -08:00
|
|
|
if ((!eina_dbl_exact(w_diff, 1.0)) || (!eina_dbl_exact(h_diff, 1.0)))
|
2014-02-10 01:27:57 -08:00
|
|
|
{
|
|
|
|
if (!tiling_window_tree_node_resize(item, w_dir, w_diff, h_dir,
|
|
|
|
h_diff))
|
|
|
|
{
|
|
|
|
/* FIXME: Do something? */
|
|
|
|
}
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
_reapply_tree();
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-01-16 09:18:29 -08:00
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_resize_begin_hook(void *data EINA_UNUSED, E_Client *ec)
|
2014-01-16 09:18:29 -08:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
Client_Extra *extra = tiling_entry_func(ec);
|
2014-01-16 09:18:29 -08:00
|
|
|
|
2014-02-20 07:49:33 -08:00
|
|
|
if (!extra || !extra->tiled)
|
2014-02-04 08:24:44 -08:00
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-01-16 09:18:29 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
Window_Tree *item = tiling_window_tree_client_find(_G.tinfo->tree, ec);
|
2014-01-16 09:18:29 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!item)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
ERR("Couldn't find tree item for resized client %p!", ec);
|
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
int edges = tiling_window_tree_edges_get(item);
|
|
|
|
|
|
|
|
if (edges & TILING_WINDOW_TREE_EDGE_LEFT)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
switch (ec->resize_mode)
|
|
|
|
{
|
|
|
|
case E_POINTER_RESIZE_L:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_NONE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_POINTER_RESIZE_TL:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_T;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_POINTER_RESIZE_BL:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_B;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
|
|
|
if (edges & TILING_WINDOW_TREE_EDGE_RIGHT)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
switch (ec->resize_mode)
|
|
|
|
{
|
|
|
|
case E_POINTER_RESIZE_R:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_NONE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_POINTER_RESIZE_TR:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_T;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_POINTER_RESIZE_BR:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_B;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
|
|
|
if (edges & TILING_WINDOW_TREE_EDGE_TOP)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
switch (ec->resize_mode)
|
|
|
|
{
|
|
|
|
case E_POINTER_RESIZE_T:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_NONE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_POINTER_RESIZE_TL:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_L;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_POINTER_RESIZE_TR:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_R;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
|
|
|
if (edges & TILING_WINDOW_TREE_EDGE_BOTTOM)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
switch (ec->resize_mode)
|
|
|
|
{
|
|
|
|
case E_POINTER_RESIZE_B:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_NONE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_POINTER_RESIZE_BL:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_L;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case E_POINTER_RESIZE_BR:
|
|
|
|
ec->resize_mode = E_POINTER_RESIZE_R;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-02-10 01:09:36 -08:00
|
|
|
|
|
|
|
if (!e_client_util_resizing_get(ec))
|
2014-02-10 01:27:57 -08:00
|
|
|
e_client_resize_cancel();
|
2014-01-16 09:18:29 -08:00
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
static Eina_Bool
|
2014-02-04 08:24:44 -08:00
|
|
|
_resize_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
|
2014-02-10 01:27:57 -08:00
|
|
|
E_Event_Client *event)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
E_Client *ec = event->ec;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
_move_or_resize(ec);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return true;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2017-03-10 12:44:08 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_move_hook(void *data EINA_UNUSED, int type EINA_UNUSED, E_Event_Client *event)
|
|
|
|
{
|
|
|
|
E_Client *ec = event->ec;
|
|
|
|
Client_Extra *extra = tiling_entry_func(ec);
|
|
|
|
|
|
|
|
if (!extra || !extra->tiled)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* A hack because e doesn't trigger events for all property changes */
|
|
|
|
if (!is_tilable(ec))
|
|
|
|
{
|
|
|
|
toggle_floating(ec);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
e_client_act_move_end(event->ec, NULL);
|
|
|
|
|
|
|
|
_reapply_tree();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-20 09:10:24 -07:00
|
|
|
static void
|
|
|
|
_frame_del_cb(void *data, Evas *evas EINA_UNUSED,
|
|
|
|
Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-03-20 09:10:24 -07:00
|
|
|
E_Client *ec = data;
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2014-03-20 09:10:24 -07:00
|
|
|
if (desk_should_tile_check(ec->desk))
|
|
|
|
{
|
|
|
|
_client_remove_no_apply(ec);
|
|
|
|
}
|
|
|
|
|
2014-05-06 06:22:01 -07:00
|
|
|
_client_untrack(ec);
|
|
|
|
|
2014-03-20 09:10:24 -07:00
|
|
|
eina_hash_del(_G.client_extras, &ec, NULL);
|
|
|
|
|
|
|
|
_reapply_tree();
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-02-13 01:41:47 -08:00
|
|
|
static void
|
2014-03-20 09:10:24 -07:00
|
|
|
_e_client_extra_unregister_callbacks(void *_client_extra)
|
|
|
|
{
|
|
|
|
Client_Extra *extra = _client_extra;
|
2014-05-06 06:22:01 -07:00
|
|
|
|
|
|
|
_client_untrack(extra->client);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_client_untrack(E_Client *ec)
|
|
|
|
{
|
|
|
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
|
|
|
|
|
|
|
if (!extra->tracked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
extra->tracked = EINA_FALSE;
|
2014-03-20 09:10:24 -07:00
|
|
|
|
|
|
|
evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_DEL,
|
|
|
|
_frame_del_cb, ec);
|
|
|
|
evas_object_smart_callback_del_full(ec->frame, "maximize_done",
|
|
|
|
_e_client_check_based_on_state_cb, ec);
|
|
|
|
evas_object_smart_callback_del_full(ec->frame, "frame_recalc_done",
|
|
|
|
_e_client_check_based_on_state_cb, ec);
|
|
|
|
evas_object_smart_callback_del_full(ec->frame, "stick",
|
|
|
|
_e_client_check_based_on_state_cb, ec);
|
|
|
|
evas_object_smart_callback_del_full(ec->frame, "unstick",
|
|
|
|
_e_client_check_based_on_state_cb, ec);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-05-06 06:22:01 -07:00
|
|
|
_client_track(E_Client *ec)
|
2014-02-13 01:41:47 -08:00
|
|
|
{
|
2014-05-06 06:22:01 -07:00
|
|
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
|
|
|
|
|
|
|
if (extra->tracked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
extra->tracked = EINA_TRUE;
|
|
|
|
|
|
|
|
evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_DEL,
|
|
|
|
_frame_del_cb, ec);
|
|
|
|
evas_object_smart_callback_add(ec->frame, "maximize_done",
|
|
|
|
_e_client_check_based_on_state_cb, ec);
|
|
|
|
evas_object_smart_callback_add(ec->frame, "frame_recalc_done",
|
|
|
|
_e_client_check_based_on_state_cb, ec);
|
|
|
|
evas_object_smart_callback_add(ec->frame, "stick",
|
|
|
|
_e_client_check_based_on_state_cb, ec);
|
|
|
|
evas_object_smart_callback_add(ec->frame, "unstick",
|
|
|
|
_e_client_check_based_on_state_cb, ec);
|
2014-02-13 01:41:47 -08:00
|
|
|
}
|
|
|
|
|
2014-05-19 01:46:05 -07:00
|
|
|
static void
|
|
|
|
_add_hook(void *data EINA_UNUSED, E_Client *ec)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-05-19 01:46:05 -07:00
|
|
|
if (!ec)
|
|
|
|
return;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-05-19 01:46:05 -07:00
|
|
|
if (!ec->new_client)
|
|
|
|
return;
|
2014-01-20 08:28:07 -08:00
|
|
|
|
2014-05-19 01:46:05 -07:00
|
|
|
if (e_object_is_del(E_OBJECT(ec)))
|
|
|
|
return;
|
|
|
|
|
2017-03-09 14:06:23 -08:00
|
|
|
_add_client(ec, _current_tiled_state(EINA_TRUE));
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-02-20 07:44:38 -08:00
|
|
|
static Eina_Bool
|
2014-02-20 07:04:59 -08:00
|
|
|
_toggle_tiling_based_on_state(E_Client *ec, Eina_Bool restore)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-20 07:04:59 -08:00
|
|
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
2012-12-06 13:22:50 -08:00
|
|
|
|
2014-02-20 07:04:59 -08:00
|
|
|
if (!extra)
|
|
|
|
{
|
2014-02-20 07:44:38 -08:00
|
|
|
return EINA_FALSE;
|
2014-02-20 07:04:59 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-20 07:04:59 -08:00
|
|
|
/* This is the new state, act accordingly. */
|
|
|
|
if (extra->tiled && !is_tilable(ec))
|
|
|
|
{
|
|
|
|
if (restore)
|
|
|
|
{
|
|
|
|
_restore_client(ec);
|
|
|
|
}
|
2014-05-16 02:21:30 -07:00
|
|
|
if (desk_should_tile_check(ec->desk))
|
|
|
|
{
|
|
|
|
_remove_client(ec);
|
|
|
|
}
|
2014-02-20 07:44:38 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2014-02-20 07:04:59 -08:00
|
|
|
}
|
|
|
|
else if (!extra->tiled && is_tilable(ec))
|
|
|
|
{
|
2017-03-09 14:06:23 -08:00
|
|
|
_add_client(ec, _current_tiled_state(EINA_FALSE));
|
2014-02-20 07:44:38 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2014-02-20 07:04:59 -08:00
|
|
|
}
|
2014-02-20 07:44:38 -08:00
|
|
|
|
|
|
|
return EINA_FALSE;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2014-02-20 07:04:59 -08:00
|
|
|
_iconify_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
|
2014-02-10 01:27:57 -08:00
|
|
|
E_Event_Client *event)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
E_Client *ec = event->ec;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (ec->deskshow)
|
2014-02-10 01:27:57 -08:00
|
|
|
return true;
|
2012-12-06 13:22:50 -08:00
|
|
|
|
2014-10-23 05:37:08 -07:00
|
|
|
_toggle_tiling_based_on_state(ec, EINA_TRUE);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return true;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
2014-02-04 08:24:44 -08:00
|
|
|
_desk_set_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
|
2014-02-10 01:27:57 -08:00
|
|
|
E_Event_Client_Desk_Set *ev)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
DBG("%p: from (%d,%d) to (%d,%d)", ev->ec, ev->desk->x, ev->desk->y,
|
|
|
|
ev->ec->desk->x, ev->ec->desk->y);
|
2017-03-10 04:49:58 -08:00
|
|
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ev->ec);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2017-03-10 04:49:58 -08:00
|
|
|
if (!extra)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//check the state of the new desk
|
|
|
|
if (desk_should_tile_check(ev->ec->desk))
|
|
|
|
{
|
2017-03-21 12:42:52 -07:00
|
|
|
if (extra->drag.drag)
|
2017-03-10 04:49:58 -08:00
|
|
|
{
|
|
|
|
ev->ec->hidden = EINA_TRUE;
|
|
|
|
e_client_comp_hidden_set(ev->ec, EINA_TRUE);
|
|
|
|
evas_object_hide(ev->ec->frame);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-03-21 12:42:52 -07:00
|
|
|
if (extra->drag.drag)
|
2017-03-10 04:49:58 -08:00
|
|
|
{
|
|
|
|
_client_drag_terminate(ev->ec);
|
|
|
|
extra->floating = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//check if we should remove that here
|
2014-02-04 08:24:44 -08:00
|
|
|
if (desk_should_tile_check(ev->desk))
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
if (tiling_window_tree_client_find(_G.tinfo->tree, ev->ec))
|
|
|
|
{
|
|
|
|
_restore_client(ev->ec);
|
|
|
|
_remove_client(ev->ec);
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2017-03-10 04:49:58 -08:00
|
|
|
if (desk_should_tile_check(ev->ec->desk))
|
|
|
|
{
|
|
|
|
_add_client(ev->ec, _current_tiled_state(EINA_FALSE));
|
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return true;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-01-17 09:15:19 -08:00
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_compositor_resize_hook_desk_reapply(E_Desk *desk)
|
2014-01-17 09:15:19 -08:00
|
|
|
{
|
|
|
|
check_tinfo(desk);
|
|
|
|
if (!desk_should_tile_check(desk))
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2014-01-17 09:15:19 -08:00
|
|
|
|
|
|
|
_reapply_tree();
|
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
static bool
|
2014-02-04 08:24:44 -08:00
|
|
|
_compositor_resize_hook(void *data EINA_UNUSED, int type EINA_UNUSED,
|
2015-03-13 13:12:35 -07:00
|
|
|
void *ev EINA_UNUSED)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-01-17 09:15:19 -08:00
|
|
|
_foreach_desk(_compositor_resize_hook_desk_reapply);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-01-17 09:15:19 -08:00
|
|
|
return true;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2014-01-16 05:13:04 -08:00
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_bd_hook(void *d EINA_UNUSED, E_Client *ec)
|
2014-01-16 05:13:04 -08:00
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
E_Menu *m;
|
|
|
|
Eina_List *l;
|
2014-02-04 08:24:44 -08:00
|
|
|
|
|
|
|
if (!ec->border_menu)
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2014-01-16 05:13:04 -08:00
|
|
|
m = ec->border_menu;
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
Client_Extra *extra = eina_hash_find(_G.client_extras, &ec);
|
|
|
|
|
|
|
|
if (!extra)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-01-20 07:14:05 -08:00
|
|
|
|
2014-01-16 05:13:04 -08:00
|
|
|
/* position menu item just before the last separator */
|
2014-02-10 01:27:57 -08:00
|
|
|
EINA_LIST_REVERSE_FOREACH(m->items, l, mi)
|
|
|
|
if (mi->separator)
|
|
|
|
break;
|
2014-02-04 08:24:44 -08:00
|
|
|
if ((!mi) || (!mi->separator))
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2014-01-16 05:13:04 -08:00
|
|
|
l = eina_list_prev(l);
|
|
|
|
mi = eina_list_data_get(l);
|
2014-02-04 08:24:44 -08:00
|
|
|
if (!mi)
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2014-01-16 05:13:04 -08:00
|
|
|
|
|
|
|
mi = e_menu_item_new_relative(m, mi);
|
|
|
|
e_menu_item_label_set(mi, _("Floating"));
|
|
|
|
e_menu_item_check_set(mi, true);
|
|
|
|
e_menu_item_toggle_set(mi, (extra->floating) ? true : false);
|
|
|
|
e_menu_item_callback_set(mi, _e_mod_menu_border_cb, ec);
|
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
/* }}} */
|
2014-02-04 08:24:44 -08:00
|
|
|
/* Module setup {{{ */
|
2012-05-02 01:20:53 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_clear_info_hash(void *data)
|
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
Tiling_Info *ti = data;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
tiling_window_tree_free(ti->tree);
|
|
|
|
ti->tree = NULL;
|
|
|
|
E_FREE(ti);
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_clear_border_extras(void *data)
|
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
Client_Extra *extra = data;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
eina_stringshare_del(extra->orig.bordername);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
E_FREE(extra);
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2017-03-09 14:06:23 -08:00
|
|
|
static void
|
|
|
|
_clear_desk_types(void *data)
|
|
|
|
{
|
|
|
|
free(data);
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Module_Api e_modapi = {
|
2014-02-04 08:24:44 -08:00
|
|
|
E_MODULE_API_VERSION,
|
|
|
|
"Tiling"
|
2012-05-02 01:20:53 -07:00
|
|
|
};
|
|
|
|
|
2017-03-13 14:26:37 -07:00
|
|
|
static unsigned char
|
|
|
|
_client_drag_mouse_up(void *data, int event EINA_UNUSED, void *event_info EINA_UNUSED)
|
2017-03-09 02:14:44 -08:00
|
|
|
{
|
2017-03-13 14:26:37 -07:00
|
|
|
E_Client *ec = data;
|
|
|
|
Client_Extra *extra = tiling_entry_func(ec);
|
|
|
|
|
2017-04-19 08:29:34 -07:00
|
|
|
if (!extra) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
2017-03-21 12:42:52 -07:00
|
|
|
if (extra->drag.drag)
|
2017-03-13 14:26:37 -07:00
|
|
|
_client_drag_terminate(data);
|
|
|
|
|
|
|
|
//remove the events
|
|
|
|
E_FREE_FUNC(extra->drag.move, ecore_event_handler_del);
|
|
|
|
E_FREE_FUNC(extra->drag.up, ecore_event_handler_del);
|
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static unsigned char
|
|
|
|
_client_drag_mouse_move(void *data, int event EINA_UNUSED, void *event_info)
|
|
|
|
{
|
|
|
|
Ecore_Event_Mouse_Move *ev = event_info;
|
2017-03-09 02:14:44 -08:00
|
|
|
Window_Tree *client;
|
|
|
|
int x,y;
|
2017-03-13 14:26:37 -07:00
|
|
|
E_Client *ec = data;
|
2017-03-10 04:49:58 -08:00
|
|
|
Client_Extra *extra = tiling_entry_no_desk_func(data);
|
|
|
|
|
|
|
|
if (!extra)
|
|
|
|
{
|
2017-03-13 14:26:37 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (evas_object_visible_get(ec->frame))
|
|
|
|
{
|
|
|
|
/*only initiaze the drag when x and y is different */
|
|
|
|
if (extra->drag.x == ev->x && extra->drag.y == ev->y) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
_client_remove_no_apply(ec);
|
|
|
|
|
2017-03-21 12:42:52 -07:00
|
|
|
extra->drag.drag = EINA_TRUE;
|
|
|
|
e_comp_grab_input(EINA_TRUE, EINA_FALSE);
|
2017-03-13 14:26:37 -07:00
|
|
|
|
|
|
|
ec->hidden = EINA_TRUE;
|
|
|
|
e_client_comp_hidden_set(ec, EINA_TRUE);
|
|
|
|
evas_object_hide(ec->frame);
|
|
|
|
|
|
|
|
_reapply_tree();
|
2017-03-10 04:49:58 -08:00
|
|
|
}
|
2017-03-09 02:14:44 -08:00
|
|
|
|
|
|
|
//now check if we can hint somehow
|
|
|
|
evas_pointer_canvas_xy_get(e_comp->evas, &x, &y);
|
|
|
|
|
|
|
|
|
2017-03-22 11:42:02 -07:00
|
|
|
//create hint if not there
|
2017-03-13 14:26:37 -07:00
|
|
|
if (!extra->drag.hint)
|
2017-03-09 02:14:44 -08:00
|
|
|
{
|
2017-03-13 14:26:37 -07:00
|
|
|
extra->drag.hint = edje_object_add(e_comp->evas);
|
|
|
|
if (!e_theme_edje_object_set(extra->drag.hint,
|
2017-03-09 02:14:44 -08:00
|
|
|
"base/theme/modules/tiling",
|
|
|
|
"modules/tiling/indicator"))
|
2017-03-13 14:26:37 -07:00
|
|
|
edje_object_file_set(extra->drag.hint, _G.edj_path, "modules/tiling/indicator");
|
|
|
|
evas_object_layer_set(extra->drag.hint, E_LAYER_CLIENT_DRAG);
|
|
|
|
evas_object_show(extra->drag.hint);
|
2017-03-21 12:42:52 -07:00
|
|
|
|
|
|
|
extra->drag.ic = e_client_icon_add(ec, evas_object_evas_get(e_comp->evas));
|
|
|
|
edje_object_part_swallow(extra->drag.hint, "e.client.icon", extra->drag.ic);
|
|
|
|
evas_object_show(extra->drag.ic);
|
2017-03-09 02:14:44 -08:00
|
|
|
}
|
|
|
|
|
2017-03-22 11:42:02 -07:00
|
|
|
//if there is nothing below, we cannot hint to anything
|
|
|
|
client = _tilable_client(x, y);
|
|
|
|
if (client)
|
|
|
|
{
|
|
|
|
Position_On_Client c;
|
|
|
|
|
|
|
|
c = _calculate_position_preference(client->client);
|
|
|
|
|
|
|
|
Eina_Rectangle pos = client->client->client;
|
|
|
|
if (c == POSITION_LEFT)
|
|
|
|
evas_object_geometry_set(extra->drag.hint, pos.x, pos.y, pos.w/2, pos.h);
|
|
|
|
else if (c == POSITION_RIGHT)
|
|
|
|
evas_object_geometry_set(extra->drag.hint, pos.x+pos.w/2, pos.y, pos.w/2, pos.h);
|
|
|
|
else if (c == POSITION_BOTTOM)
|
|
|
|
evas_object_geometry_set(extra->drag.hint, pos.x, pos.y + pos.h/2, pos.w, pos.h/2);
|
|
|
|
else if (c == POSITION_TOP)
|
|
|
|
evas_object_geometry_set(extra->drag.hint, pos.x, pos.y, pos.w, pos.h/2);
|
|
|
|
evas_object_show(extra->drag.hint);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//if there is no client, just highlight the zone
|
|
|
|
Eina_Rectangle geom;
|
|
|
|
E_Zone *zone = e_zone_current_get();
|
|
|
|
e_zone_useful_geometry_get(zone, &geom.x, &geom.y, &geom.w, &geom.h);
|
|
|
|
evas_object_geometry_set(extra->drag.hint, EINA_RECTANGLE_ARGS(&geom));
|
|
|
|
evas_object_show(extra->drag.hint);
|
|
|
|
}
|
2017-03-13 14:26:37 -07:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2017-03-09 02:14:44 -08:00
|
|
|
}
|
|
|
|
|
2017-03-10 04:49:58 -08:00
|
|
|
static void
|
|
|
|
_client_drag_terminate(E_Client *ec)
|
2017-03-09 02:14:44 -08:00
|
|
|
{
|
2017-03-10 04:49:58 -08:00
|
|
|
Client_Extra *extra = tiling_entry_no_desk_func(ec);
|
2017-03-09 02:14:44 -08:00
|
|
|
|
|
|
|
if (!extra)
|
|
|
|
{
|
2017-03-10 04:49:58 -08:00
|
|
|
return;
|
2017-03-09 02:14:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
//we grappend the comp when we started the drag
|
|
|
|
e_comp_ungrab_input(EINA_TRUE, EINA_FALSE);
|
|
|
|
|
|
|
|
//insert the client at the position where the up was
|
2017-03-10 04:49:58 -08:00
|
|
|
if (desk_should_tile_check(get_current_desk()))
|
|
|
|
{
|
|
|
|
_insert_client_prefered(ec);
|
|
|
|
extra->tiled = EINA_TRUE;
|
|
|
|
}
|
2017-03-09 02:14:44 -08:00
|
|
|
|
|
|
|
//remove the hint object
|
2017-03-13 14:26:37 -07:00
|
|
|
E_FREE_FUNC(extra->drag.hint, evas_object_del);
|
|
|
|
E_FREE_FUNC(extra->drag.ic, evas_object_del);
|
2017-03-09 02:14:44 -08:00
|
|
|
|
|
|
|
//bring up the client again
|
|
|
|
ec->hidden = EINA_FALSE;
|
|
|
|
e_client_comp_hidden_set(ec, EINA_FALSE);
|
|
|
|
evas_object_show(ec->frame);
|
|
|
|
|
2017-03-13 14:26:37 -07:00
|
|
|
//remove the events
|
|
|
|
E_FREE_FUNC(extra->drag.move, ecore_event_handler_del);
|
|
|
|
E_FREE_FUNC(extra->drag.up, ecore_event_handler_del);
|
2017-03-09 02:14:44 -08:00
|
|
|
|
|
|
|
_reapply_tree();
|
|
|
|
|
|
|
|
evas_object_focus_set(ec->frame, EINA_TRUE);
|
2017-03-21 12:42:52 -07:00
|
|
|
|
|
|
|
extra->drag.drag = EINA_FALSE;
|
2017-03-10 04:49:58 -08:00
|
|
|
}
|
2017-03-09 02:14:44 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
_client_move_begin(void *data EINA_UNUSED, E_Client *ec)
|
|
|
|
{
|
|
|
|
Client_Extra *extra = tiling_entry_func(ec);
|
|
|
|
|
|
|
|
if (!extra || !extra->tiled)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-03-13 14:26:37 -07:00
|
|
|
//listen for mouse moves when the move starts we are starting a drag
|
|
|
|
evas_pointer_canvas_xy_get(e_comp->evas, &extra->drag.x, &extra->drag.y);
|
|
|
|
extra->drag.move = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _client_drag_mouse_move, ec);
|
|
|
|
extra->drag.up = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _client_drag_mouse_up, ec);
|
2017-03-09 02:14:44 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-03-09 14:06:23 -08:00
|
|
|
static void
|
|
|
|
_update_current_desk(E_Desk *new)
|
|
|
|
{
|
|
|
|
Desk_Split_Type *type;
|
|
|
|
|
|
|
|
type = eina_hash_find(_G.desk_type, &new);
|
|
|
|
|
|
|
|
if (!type)
|
|
|
|
{
|
|
|
|
type = calloc(1, sizeof(Desk_Split_Type));
|
|
|
|
type->desk = new;
|
|
|
|
type->type = TILING_SPLIT_HORIZONTAL;
|
|
|
|
eina_hash_add(_G.desk_type, &new, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
_G.current_split_type = type;
|
|
|
|
}
|
|
|
|
|
2017-03-10 04:49:58 -08:00
|
|
|
static bool
|
2017-03-09 14:06:23 -08:00
|
|
|
_desk_shown(void *data EINA_UNUSED, int types EINA_UNUSED, void *event_info)
|
|
|
|
{
|
|
|
|
E_Event_Desk_Show *ev = event_info;
|
|
|
|
|
|
|
|
if (!ev->desk)
|
|
|
|
{
|
|
|
|
ERR("The shown desk can never be NULL!");
|
2017-03-10 04:49:58 -08:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2017-03-09 14:06:23 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
_update_current_desk(ev->desk);
|
2017-03-10 03:04:38 -08:00
|
|
|
_tiling_gadgets_update();
|
2017-03-10 04:49:58 -08:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2017-03-09 14:06:23 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void *
|
2014-02-10 01:27:57 -08:00
|
|
|
e_modapi_init(E_Module *m)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
E_Desk *desk;
|
|
|
|
Eina_List *l;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
tiling_g.module = m;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (tiling_g.log_domain < 0)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
tiling_g.log_domain = eina_log_domain_register("tiling", NULL);
|
|
|
|
if (tiling_g.log_domain < 0)
|
|
|
|
{
|
|
|
|
EINA_LOG_CRIT("could not register log domain 'tiling'");
|
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
_G.info_hash = eina_hash_pointer_new(_clear_info_hash);
|
|
|
|
_G.client_extras = eina_hash_pointer_new(_clear_border_extras);
|
2017-03-09 14:06:23 -08:00
|
|
|
_G.desk_type = eina_hash_pointer_new(_clear_desk_types);
|
2014-02-10 01:27:57 -08:00
|
|
|
#define HANDLER(_h, _e, _f) \
|
|
|
|
_h = ecore_event_handler_add(E_EVENT_##_e, \
|
|
|
|
(Ecore_Event_Handler_Cb)_f, \
|
|
|
|
NULL);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-18 06:08:57 -08:00
|
|
|
_G.handler_client_resize_begin =
|
|
|
|
e_client_hook_add(E_CLIENT_HOOK_RESIZE_BEGIN, _resize_begin_hook, NULL);
|
2017-03-09 02:14:44 -08:00
|
|
|
_G.handler_move_begin =
|
|
|
|
e_client_hook_add(E_CLIENT_HOOK_MOVE_BEGIN, _client_move_begin, NULL);
|
|
|
|
|
2017-02-10 14:23:44 -08:00
|
|
|
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
|
|
|
|
_G.handler_client_add =
|
|
|
|
e_client_hook_add(E_CLIENT_HOOK_EVAL_PRE_FRAME_ASSIGN, _add_hook, NULL);
|
|
|
|
else
|
|
|
|
_G.handler_client_add =
|
|
|
|
e_client_hook_add(E_CLIENT_HOOK_UNIGNORE, _add_hook, NULL);
|
2014-02-04 08:24:44 -08:00
|
|
|
HANDLER(_G.handler_client_resize, CLIENT_RESIZE, _resize_hook);
|
2017-03-10 12:44:08 -08:00
|
|
|
HANDLER(_G.handler_client_move, CLIENT_MOVE, _move_hook);
|
2014-02-04 08:24:44 -08:00
|
|
|
|
|
|
|
HANDLER(_G.handler_client_iconify, CLIENT_ICONIFY, _iconify_hook);
|
2014-02-20 07:04:59 -08:00
|
|
|
HANDLER(_G.handler_client_uniconify, CLIENT_UNICONIFY, _iconify_hook);
|
2014-02-04 08:24:44 -08:00
|
|
|
|
|
|
|
HANDLER(_G.handler_desk_set, CLIENT_DESK_SET, _desk_set_hook);
|
2017-09-01 10:40:12 -07:00
|
|
|
HANDLER(_G.handler_compositor_resize, COMPOSITOR_UPDATE,
|
2014-02-10 01:27:57 -08:00
|
|
|
_compositor_resize_hook);
|
2017-03-09 14:06:23 -08:00
|
|
|
HANDLER(_G.handler_desk_show, DESK_SHOW, _desk_shown);
|
2012-05-02 01:20:53 -07:00
|
|
|
#undef HANDLER
|
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
#define ACTION_ADD(_action, _cb, _title, _value, _params, _example, _editable) \
|
|
|
|
{ \
|
|
|
|
const char *_name = _value; \
|
|
|
|
if ((_action = e_action_add(_name))) { \
|
|
|
|
_action->func.go = _cb; \
|
|
|
|
e_action_predef_name_set(N_("Tiling"), _title, _name, \
|
|
|
|
_params, _example, _editable); \
|
|
|
|
} \
|
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
/* Module's actions */
|
|
|
|
ACTION_ADD(_G.act_togglefloat, _e_mod_action_toggle_floating_cb,
|
2014-02-10 01:27:57 -08:00
|
|
|
N_("Toggle floating"), "toggle_floating", NULL, NULL, 0);
|
2014-02-04 08:24:44 -08:00
|
|
|
|
|
|
|
ACTION_ADD(_G.act_move_up, _e_mod_action_move_up_cb,
|
2014-02-10 01:27:57 -08:00
|
|
|
N_("Move the focused window up"), "move_up", NULL, NULL, 0);
|
2014-02-04 08:24:44 -08:00
|
|
|
ACTION_ADD(_G.act_move_down, _e_mod_action_move_down_cb,
|
2014-02-10 01:27:57 -08:00
|
|
|
N_("Move the focused window down"), "move_down", NULL, NULL, 0);
|
2014-02-04 08:24:44 -08:00
|
|
|
ACTION_ADD(_G.act_move_left, _e_mod_action_move_left_cb,
|
2014-02-10 01:27:57 -08:00
|
|
|
N_("Move the focused window left"), "move_left", NULL, NULL, 0);
|
2014-02-04 08:24:44 -08:00
|
|
|
ACTION_ADD(_G.act_move_right, _e_mod_action_move_right_cb,
|
2014-02-10 01:27:57 -08:00
|
|
|
N_("Move the focused window right"), "move_right", NULL, NULL, 0);
|
2014-02-04 08:24:44 -08:00
|
|
|
|
|
|
|
ACTION_ADD(_G.act_toggle_split_mode, _e_mod_action_toggle_split_mode,
|
2017-08-14 01:13:49 -07:00
|
|
|
N_("Toggle split mode for new windows."), "toggle_split_mode", NULL, NULL, 0);
|
2014-02-04 08:24:44 -08:00
|
|
|
|
|
|
|
ACTION_ADD(_G.act_swap_window, NULL, N_("Swap window"), "swap_window", NULL,
|
2014-02-10 01:27:57 -08:00
|
|
|
NULL, 0);
|
2014-02-04 08:24:44 -08:00
|
|
|
_G.act_swap_window->func.go_mouse = _e_mod_action_swap_window_go_mouse;
|
|
|
|
_G.act_swap_window->func.end_mouse = _e_mod_action_swap_window_end_mouse;
|
2014-01-23 06:58:49 -08:00
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
#undef ACTION_ADD
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
/* Configuration entries */
|
|
|
|
snprintf(_G.edj_path, sizeof(_G.edj_path), "%s/e-module-tiling.edj",
|
2014-02-10 01:27:57 -08:00
|
|
|
e_module_dir_get(m));
|
2014-02-04 08:24:44 -08:00
|
|
|
e_configure_registry_category_add("windows", 50, _("Windows"), NULL,
|
2014-02-10 01:27:57 -08:00
|
|
|
"preferences-system-windows");
|
2014-02-04 08:24:44 -08:00
|
|
|
e_configure_registry_item_add("windows/tiling", 150, _("Tiling"), NULL,
|
2014-02-10 01:27:57 -08:00
|
|
|
_G.edj_path, e_int_config_tiling_module);
|
2014-02-04 08:24:44 -08:00
|
|
|
|
|
|
|
/* Configuration itself */
|
|
|
|
_G.config_edd = E_CONFIG_DD_NEW("Tiling_Config", Config);
|
|
|
|
_G.vdesk_edd = E_CONFIG_DD_NEW("Tiling_Config_VDesk", struct _Config_vdesk);
|
|
|
|
|
|
|
|
E_CONFIG_VAL(_G.config_edd, Config, tile_dialogs, INT);
|
|
|
|
E_CONFIG_VAL(_G.config_edd, Config, show_titles, INT);
|
2014-02-06 08:57:48 -08:00
|
|
|
E_CONFIG_VAL(_G.config_edd, Config, have_floating_mode, INT);
|
2014-02-07 02:01:40 -08:00
|
|
|
E_CONFIG_VAL(_G.config_edd, Config, window_padding, INT);
|
2014-02-04 08:24:44 -08:00
|
|
|
|
|
|
|
E_CONFIG_LIST(_G.config_edd, Config, vdesks, _G.vdesk_edd);
|
|
|
|
E_CONFIG_VAL(_G.vdesk_edd, struct _Config_vdesk, x, INT);
|
|
|
|
E_CONFIG_VAL(_G.vdesk_edd, struct _Config_vdesk, y, INT);
|
|
|
|
E_CONFIG_VAL(_G.vdesk_edd, struct _Config_vdesk, zone_num, INT);
|
|
|
|
E_CONFIG_VAL(_G.vdesk_edd, struct _Config_vdesk, nb_stacks, INT);
|
|
|
|
|
|
|
|
tiling_g.config = e_config_domain_load("module.tiling", _G.config_edd);
|
|
|
|
if (!tiling_g.config)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
tiling_g.config = E_NEW(Config, 1);
|
|
|
|
tiling_g.config->tile_dialogs = 1;
|
|
|
|
tiling_g.config->show_titles = 1;
|
2014-02-06 08:57:48 -08:00
|
|
|
tiling_g.config->have_floating_mode = 1;
|
2014-02-07 02:01:40 -08:00
|
|
|
tiling_g.config->window_padding = 0;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
E_CONFIG_LIMIT(tiling_g.config->tile_dialogs, 0, 1);
|
|
|
|
E_CONFIG_LIMIT(tiling_g.config->show_titles, 0, 1);
|
2014-02-06 08:57:48 -08:00
|
|
|
E_CONFIG_LIMIT(tiling_g.config->have_floating_mode, 0, 1);
|
2014-02-07 02:01:40 -08:00
|
|
|
E_CONFIG_LIMIT(tiling_g.config->window_padding, 0, TILING_MAX_PADDING);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
for (l = tiling_g.config->vdesks; l; l = l->next)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
struct _Config_vdesk *vd;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
vd = l->data;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
E_CONFIG_LIMIT(vd->nb_stacks, 0, 1);
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
_G.client_menu_hook = e_int_client_menu_hook_add(_bd_hook, NULL);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
desk = get_current_desk();
|
|
|
|
_G.tinfo = _initialize_tinfo(desk);
|
2014-01-16 05:13:04 -08:00
|
|
|
|
2017-03-09 14:06:23 -08:00
|
|
|
_update_current_desk(get_current_desk());
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
/* Add all the existing windows. */
|
|
|
|
{
|
|
|
|
E_Client *ec;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2015-03-13 12:45:07 -07:00
|
|
|
E_CLIENT_FOREACH(ec)
|
2014-01-17 08:24:53 -08:00
|
|
|
{
|
2017-03-09 14:06:23 -08:00
|
|
|
_add_client(ec, _current_tiled_state(EINA_TRUE));
|
2014-01-17 08:24:53 -08:00
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-07-29 21:51:03 -07:00
|
|
|
started = EINA_TRUE;
|
|
|
|
_reapply_tree();
|
2014-02-06 08:06:32 -08:00
|
|
|
e_gadcon_provider_register(&_gc_class);
|
|
|
|
|
2017-03-09 14:06:23 -08:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return m;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2012-12-01 05:53:51 -08:00
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_disable_desk(E_Desk *desk)
|
2012-12-01 05:53:51 -08:00
|
|
|
{
|
2014-01-13 09:18:08 -08:00
|
|
|
check_tinfo(desk);
|
|
|
|
if (!_G.tinfo->conf)
|
2014-02-10 01:27:57 -08:00
|
|
|
return;
|
2012-12-01 05:53:51 -08:00
|
|
|
|
2014-01-13 09:18:08 -08:00
|
|
|
tiling_window_tree_walk(_G.tinfo->tree, _restore_free_client);
|
|
|
|
_G.tinfo->tree = NULL;
|
2012-12-01 05:53:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_disable_all_tiling(void)
|
2014-01-17 09:13:22 -08:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
_foreach_desk(_disable_desk);
|
2014-01-17 09:13:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-02-10 01:27:57 -08:00
|
|
|
_foreach_desk(void (*func)(E_Desk *desk))
|
2012-12-01 05:53:51 -08:00
|
|
|
{
|
2015-01-05 12:27:41 -08:00
|
|
|
const Eina_List *l;
|
2014-02-04 08:24:44 -08:00
|
|
|
E_Zone *zone;
|
|
|
|
E_Desk *desk;
|
|
|
|
int x, y;
|
|
|
|
|
2015-01-05 12:27:41 -08:00
|
|
|
EINA_LIST_FOREACH(e_comp->zones, l, zone)
|
2014-02-10 01:27:57 -08:00
|
|
|
{
|
2015-01-05 12:27:41 -08:00
|
|
|
for (x = 0; x < zone->desk_x_count; x++)
|
2014-02-10 01:27:57 -08:00
|
|
|
{
|
2015-01-05 12:27:41 -08:00
|
|
|
for (y = 0; y < zone->desk_y_count; y++)
|
2014-02-10 01:27:57 -08:00
|
|
|
{
|
2015-01-05 12:27:41 -08:00
|
|
|
desk = zone->desks[x + (y * zone->desk_x_count)];
|
2014-02-10 01:27:57 -08:00
|
|
|
|
2015-01-05 12:27:41 -08:00
|
|
|
func(desk);
|
2014-02-10 01:27:57 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-12-01 05:53:51 -08:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2014-02-10 01:27:57 -08:00
|
|
|
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-06 08:06:32 -08:00
|
|
|
e_gadcon_provider_unregister(&_gc_class);
|
2014-07-29 21:51:03 -07:00
|
|
|
started = EINA_FALSE;
|
2014-02-04 08:24:44 -08:00
|
|
|
_disable_all_tiling();
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
e_int_client_menu_hook_del(_G.client_menu_hook);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
if (tiling_g.log_domain >= 0)
|
|
|
|
{
|
2014-02-10 01:27:57 -08:00
|
|
|
eina_log_domain_unregister(tiling_g.log_domain);
|
|
|
|
tiling_g.log_domain = -1;
|
2014-02-04 08:24:44 -08:00
|
|
|
}
|
2014-02-18 06:08:57 -08:00
|
|
|
#define SAFE_FREE(x, freefunc) \
|
|
|
|
if (x) \
|
|
|
|
{ \
|
|
|
|
freefunc(x); \
|
|
|
|
x = NULL; \
|
|
|
|
}
|
2014-02-10 01:27:57 -08:00
|
|
|
#define FREE_HANDLER(x) \
|
2014-02-18 06:08:57 -08:00
|
|
|
SAFE_FREE(x, ecore_event_handler_del);
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
FREE_HANDLER(_G.handler_client_resize);
|
|
|
|
FREE_HANDLER(_G.handler_client_move);
|
|
|
|
|
|
|
|
FREE_HANDLER(_G.handler_client_iconify);
|
|
|
|
FREE_HANDLER(_G.handler_client_uniconify);
|
|
|
|
|
|
|
|
FREE_HANDLER(_G.handler_desk_set);
|
2014-02-18 06:08:57 -08:00
|
|
|
|
|
|
|
SAFE_FREE(_G.handler_client_resize_begin, e_client_hook_del);
|
2014-06-03 04:42:30 -07:00
|
|
|
SAFE_FREE(_G.handler_client_add, e_client_hook_del);
|
2012-05-02 01:20:53 -07:00
|
|
|
#undef FREE_HANDLER
|
2014-02-18 06:08:57 -08:00
|
|
|
#undef SAFE_FREE
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
#define ACTION_DEL(act, title, value) \
|
|
|
|
if (act) { \
|
|
|
|
e_action_predef_name_del("Tiling", title); \
|
|
|
|
e_action_del(value); \
|
|
|
|
act = NULL; \
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
ACTION_DEL(_G.act_togglefloat, "Toggle floating", "toggle_floating");
|
|
|
|
ACTION_DEL(_G.act_move_up, "Move the focused window up", "move_up");
|
|
|
|
ACTION_DEL(_G.act_move_down, "Move the focused window down", "move_down");
|
|
|
|
ACTION_DEL(_G.act_move_left, "Move the focused window left", "move_left");
|
|
|
|
ACTION_DEL(_G.act_move_right, "Move the focused window right", "move_right");
|
|
|
|
|
2016-09-06 07:33:18 -07:00
|
|
|
ACTION_DEL(_G.act_toggle_split_mode, "Toggle split mode for new windows.",
|
2014-02-10 01:27:57 -08:00
|
|
|
"toggle_split_mode");
|
2014-02-04 08:24:44 -08:00
|
|
|
ACTION_DEL(_G.act_swap_window, "Swap window", "swap_window");
|
2012-05-02 01:20:53 -07:00
|
|
|
#undef ACTION_DEL
|
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
e_configure_registry_item_del("windows/tiling");
|
|
|
|
e_configure_registry_category_del("windows");
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
E_FREE(tiling_g.config);
|
|
|
|
E_CONFIG_DD_FREE(_G.config_edd);
|
|
|
|
E_CONFIG_DD_FREE(_G.vdesk_edd);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
tiling_g.module = NULL;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
eina_hash_free(_G.info_hash);
|
|
|
|
_G.info_hash = NULL;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-03-20 09:10:24 -07:00
|
|
|
eina_hash_free_cb_set(_G.client_extras, _e_client_extra_unregister_callbacks);
|
2014-02-04 08:24:44 -08:00
|
|
|
eina_hash_free(_G.client_extras);
|
|
|
|
_G.client_extras = NULL;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
_G.tinfo = NULL;
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return 1;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2014-02-10 01:27:57 -08:00
|
|
|
e_modapi_save(E_Module *m EINA_UNUSED)
|
2012-05-02 01:20:53 -07:00
|
|
|
{
|
2014-02-04 08:24:44 -08:00
|
|
|
e_config_domain_save("module.tiling", _G.config_edd, tiling_g.config);
|
2012-05-02 01:20:53 -07:00
|
|
|
|
2014-02-04 08:24:44 -08:00
|
|
|
return true;
|
2012-05-02 01:20:53 -07:00
|
|
|
}
|
2014-02-04 08:24:44 -08:00
|
|
|
|
2014-02-06 08:06:32 -08:00
|
|
|
/* GADGET STUFF. */
|
|
|
|
|
|
|
|
/* Hack to properly save and free the gadget id. */
|
|
|
|
static Eina_Stringshare *_current_gad_id = NULL;
|
|
|
|
|
|
|
|
static void
|
2014-05-06 07:44:35 -07:00
|
|
|
_edje_tiling_icon_set(Evas_Object *o)
|
2014-02-06 08:06:32 -08:00
|
|
|
{
|
2017-03-09 14:06:23 -08:00
|
|
|
switch (_current_tiled_state(EINA_TRUE))
|
2014-02-06 08:06:32 -08:00
|
|
|
{
|
|
|
|
case TILING_SPLIT_HORIZONTAL:
|
2014-05-06 07:44:35 -07:00
|
|
|
edje_object_signal_emit(o, "tiling,mode,horizontal", "e");
|
2014-02-10 01:27:57 -08:00
|
|
|
break;
|
|
|
|
|
2014-02-06 08:06:32 -08:00
|
|
|
case TILING_SPLIT_VERTICAL:
|
2014-05-06 07:44:35 -07:00
|
|
|
edje_object_signal_emit(o, "tiling,mode,vertical", "e");
|
2014-02-10 01:27:57 -08:00
|
|
|
break;
|
|
|
|
|
2014-02-06 08:06:32 -08:00
|
|
|
case TILING_SPLIT_FLOAT:
|
2014-05-06 07:44:35 -07:00
|
|
|
edje_object_signal_emit(o, "tiling,mode,floating", "e");
|
2014-02-10 01:27:57 -08:00
|
|
|
break;
|
|
|
|
|
2014-02-06 08:06:32 -08:00
|
|
|
default:
|
2014-02-10 01:27:57 -08:00
|
|
|
ERR("Unknown split type.");
|
2014-02-06 08:06:32 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-06 07:44:35 -07:00
|
|
|
static void
|
|
|
|
_gadget_icon_set(Instance *inst)
|
|
|
|
{
|
|
|
|
_edje_tiling_icon_set(inst->gadget);
|
|
|
|
}
|
|
|
|
|
2014-02-12 03:55:14 -08:00
|
|
|
static void
|
|
|
|
_tiling_cb_menu_configure(void *data EINA_UNUSED, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED)
|
|
|
|
{
|
|
|
|
// FIXME here need to be some checks and return ?
|
|
|
|
e_int_config_tiling_module(NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2014-02-06 08:06:32 -08:00
|
|
|
static void
|
|
|
|
_gadget_mouse_down_cb(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
|
|
|
Instance *inst = data;
|
|
|
|
|
|
|
|
if (ev->button == 1) /* Change on left-click. */
|
|
|
|
{
|
|
|
|
_tiling_split_type_next();
|
|
|
|
}
|
|
|
|
else if (ev->button == 3)
|
|
|
|
{
|
|
|
|
E_Zone *zone;
|
|
|
|
E_Menu *m;
|
2014-02-06 15:45:09 -08:00
|
|
|
E_Menu_Item *mi;
|
2014-02-06 08:06:32 -08:00
|
|
|
int x, y;
|
|
|
|
|
2015-03-13 14:47:36 -07:00
|
|
|
zone = e_zone_current_get();
|
2014-02-06 08:06:32 -08:00
|
|
|
|
|
|
|
m = e_menu_new();
|
2014-02-06 15:45:09 -08:00
|
|
|
mi = e_menu_item_new(m);
|
|
|
|
e_menu_item_label_set(mi, _("Settings"));
|
|
|
|
e_util_menu_item_theme_icon_set(mi, "configure");
|
|
|
|
e_menu_item_callback_set(mi, _tiling_cb_menu_configure, NULL);
|
2014-02-06 08:06:32 -08:00
|
|
|
|
|
|
|
m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
|
|
|
|
|
|
|
|
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, NULL, NULL);
|
|
|
|
e_menu_activate_mouse(m, zone, x + ev->output.x, y + ev->output.y,
|
|
|
|
1, 1, E_MENU_POP_DIRECTION_AUTO, ev->timestamp);
|
|
|
|
evas_event_feed_mouse_up(e, ev->button,
|
|
|
|
EVAS_BUTTON_NONE, ev->timestamp, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static E_Gadcon_Client *
|
|
|
|
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
E_Gadcon_Client *gcc;
|
|
|
|
Instance *inst;
|
|
|
|
|
|
|
|
inst = E_NEW(Instance, 1);
|
|
|
|
|
|
|
|
o = edje_object_add(gc->evas);
|
|
|
|
if (!e_theme_edje_object_set(o, "base/theme/modules/tiling",
|
|
|
|
"modules/tiling/main"))
|
2014-02-10 01:27:57 -08:00
|
|
|
edje_object_file_set(o, _G.edj_path, "modules/tiling/main");
|
2014-02-06 08:06:32 -08:00
|
|
|
evas_object_show(o);
|
|
|
|
|
|
|
|
gcc = e_gadcon_client_new(gc, name, id, style, o);
|
|
|
|
gcc->data = inst;
|
|
|
|
inst->gcc = gcc;
|
|
|
|
inst->gad_id = _current_gad_id;
|
|
|
|
_current_gad_id = NULL;
|
|
|
|
|
|
|
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
|
|
|
|
_gadget_mouse_down_cb, inst);
|
|
|
|
|
|
|
|
inst->gadget = o;
|
|
|
|
|
|
|
|
_gadget_icon_set(inst);
|
|
|
|
|
|
|
|
tiling_g.gadget_instances = eina_list_append(tiling_g.gadget_instances, inst);
|
|
|
|
|
|
|
|
return gcc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gc_shutdown(E_Gadcon_Client *gcc)
|
|
|
|
{
|
|
|
|
Instance *inst;
|
|
|
|
Evas_Object *o;
|
|
|
|
|
|
|
|
if (!(inst = gcc->data)) return;
|
|
|
|
|
|
|
|
o = inst->gadget;
|
|
|
|
|
|
|
|
evas_object_event_callback_del_full(o, EVAS_CALLBACK_MOUSE_DOWN,
|
2014-02-10 01:27:57 -08:00
|
|
|
_gadget_mouse_down_cb, inst);
|
2014-02-06 08:06:32 -08:00
|
|
|
|
|
|
|
if (inst->gadget)
|
2014-02-10 01:27:57 -08:00
|
|
|
evas_object_del(inst->gadget);
|
2014-02-06 08:06:32 -08:00
|
|
|
|
|
|
|
tiling_g.gadget_instances = eina_list_remove(tiling_g.gadget_instances, inst);
|
|
|
|
|
|
|
|
eina_stringshare_del(inst->gad_id);
|
|
|
|
|
|
|
|
E_FREE(inst);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient EINA_UNUSED)
|
|
|
|
{
|
|
|
|
e_gadcon_client_aspect_set(gcc, 16, 16);
|
|
|
|
e_gadcon_client_min_size_set(gcc, 16, 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
_gc_label(const E_Gadcon_Client_Class *client_class EINA_UNUSED)
|
|
|
|
{
|
|
|
|
return _("Tiling");
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
|
|
|
_gc_icon(const E_Gadcon_Client_Class *client_class EINA_UNUSED, Evas *evas)
|
|
|
|
{
|
|
|
|
Evas_Object *o;
|
|
|
|
|
2014-02-10 01:27:57 -08:00
|
|
|
o = edje_object_add(evas);
|
2014-02-06 08:06:32 -08:00
|
|
|
edje_object_file_set(o, _G.edj_path, "icon");
|
|
|
|
return o;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
_gc_id_new(const E_Gadcon_Client_Class *client_class EINA_UNUSED)
|
|
|
|
{
|
|
|
|
char buf[1024];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "%s %d", _("Tiling"), tiling_g.gadget_number);
|
|
|
|
|
|
|
|
tiling_g.gadget_number++;
|
|
|
|
|
|
|
|
return _current_gad_id = eina_stringshare_add(buf);
|
|
|
|
}
|
|
|
|
|
2012-05-02 01:20:53 -07:00
|
|
|
/* }}} */
|