e_win is a quick api wrapper for makign internal windows that the wm creates

then manages as if they were normal client windows. should work just fine and
is something to build better dialogs on top of


SVN revision: 15728
This commit is contained in:
Carsten Haitzler 2005-07-11 09:19:17 +00:00
parent ef70a33cd7
commit 30d026df6f
11 changed files with 451 additions and 6 deletions

1
TODO
View File

@ -8,6 +8,7 @@ Some of the things (in very short form) that need to be done to E17...
BUGS / FIXES
-------------------------------------------------------------------------------
* rememebr desk doesnt work
* e_hints.c manually changes flags on a border isnetad of calling
e_border_stick() for exampe or the calls in e_border.c - add calls as needed
to e_border.c. before calling check the lock flags too.

View File

@ -65,7 +65,8 @@ e_alert.h \
e_maximize.h \
e_grabinput.h \
e_bg.h \
e_remember.h
e_remember.h \
e_win.h
enlightenment_SOURCES = \
e_main.c \
@ -120,6 +121,7 @@ e_maximize.c \
e_grabinput.c \
e_bg.c \
e_remember.c \
e_win.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_LDFLAGS = -export-dynamic @e_libs@ @x_libs@ @dlopen_libs@

View File

@ -1702,6 +1702,7 @@ e_border_act_close_begin(E_Border *bd)
void
e_border_act_kill_begin(E_Border *bd)
{
if (bd->internal) return;
if (bd->lock_close) return;
if ((bd->client.netwm.pid > 1) && (e_config->kill_process))
{
@ -5664,7 +5665,7 @@ _e_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y, int key)
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
if (!bd->lock_close)
if ((!bd->lock_close) && (!bd->internal))
{
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Kill"));
@ -5880,7 +5881,7 @@ _e_border_menu_cb_kill(void *data, E_Menu *m, E_Menu_Item *mi)
E_Border *bd;
bd = data;
if (!bd->lock_close)
if ((!bd->lock_close) && (!bd->internal))
e_border_act_kill_begin(bd);
}

View File

@ -310,7 +310,8 @@ struct _E_Border
unsigned int lock_close : 1; /*DONE*/
unsigned int lock_focus_in : 1; /*DONE*/
unsigned int lock_focus_out : 1; /*DONE*/
unsigned int lock_life : 1;
unsigned int lock_life : 1; /*DONE*/
unsigned int internal : 1;
double ping;

View File

@ -53,3 +53,4 @@
#include "e_grabinput.h"
#include "e_bg.h"
#include "e_remember.h"
#include "e_win.h"

View File

@ -698,6 +698,7 @@ _e_main_screens_init(void)
}
if (!e_focus_init()) return 0;
if (!e_border_init()) return 0;
if (!e_win_init()) return 0;
for (i = 0; i < num; i++)
{
E_Manager *man;
@ -741,6 +742,7 @@ _e_main_screens_init(void)
static int
_e_main_screens_shutdown(void)
{
e_win_shutdown();
e_border_shutdown();
e_focus_shutdown();
e_menu_shutdown();

View File

@ -80,6 +80,8 @@ e_popup_new(E_Zone *zone, int x, int y, int w, int h)
void
e_popup_show(E_Popup *pop)
{
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
if (pop->visible) return;
pop->visible = 1;
ecore_evas_show(pop->ecore_evas);
@ -89,6 +91,8 @@ e_popup_show(E_Popup *pop)
void
e_popup_hide(E_Popup *pop)
{
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
if (!pop->visible) return;
pop->visible = 0;
ecore_evas_hide(pop->ecore_evas);
@ -98,6 +102,8 @@ e_popup_hide(E_Popup *pop)
void
e_popup_move(E_Popup *pop, int x, int y)
{
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
if ((pop->x == x) && (pop->y == y)) return;
pop->x = x;
pop->y = y;
@ -112,6 +118,8 @@ e_popup_move(E_Popup *pop, int x, int y)
void
e_popup_resize(E_Popup *pop, int w, int h)
{
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
if ((pop->w == w) && (pop->h == h)) return;
pop->w = w;
pop->h = h;
@ -122,6 +130,8 @@ e_popup_resize(E_Popup *pop, int w, int h)
void
e_popup_move_resize(E_Popup *pop, int x, int y, int w, int h)
{
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
if ((pop->x == x) && (pop->y == y) &&
(pop->w == w) && (pop->h == h)) return;
pop->x = x;
@ -143,6 +153,8 @@ e_popup_edje_bg_object_set(E_Popup *pop, Evas_Object *o)
{
const char *shape_option;
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
shape_option = edje_object_data_get(o, "shaped");
if (shape_option)
{
@ -157,6 +169,8 @@ e_popup_edje_bg_object_set(E_Popup *pop, Evas_Object *o)
void
e_popup_layer_set(E_Popup *pop, int layer)
{
E_OBJECT_CHECK(pop);
E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE);
pop->layer = layer;
e_container_window_raise(pop->zone->container, pop->evas_win, pop->layer);
}

View File

@ -206,6 +206,48 @@ _e_test_internal(E_Container *con)
{
_e_test_timer(NULL);
}
#elif 0
static void
_e_test_resize(E_Win *win)
{
Evas_Object *o;
o = win->data;
printf("RESIZE %i %i\n", win->w, win->h);
evas_object_resize(o, win->w, win->h);
evas_object_color_set(o, rand() & 0xff, rand() & 0xff, rand() & 0xff, 255);
}
static void
_e_test_delete(E_Win *win)
{
printf("DEL!\n");
e_object_del(E_OBJECT(win));
}
static void
_e_test_internal(E_Container *con)
{
E_Win *win;
Evas_Object *o;
win = e_win_new(con);
e_win_resize_callback_set(win, _e_test_resize);
e_win_delete_callback_set(win, _e_test_delete);
e_win_placed_set(win, 0);
e_win_move_resize(win, 10, 80, 400, 200);
e_win_name_class_set(win, "E", "_test_window");
e_win_title_set(win, "A test window");
e_win_raise(win);
e_win_show(win);
o = evas_object_rectangle_add(e_win_evas_get(win));
evas_object_color_set(o, 255, 200, 100, 255);
evas_object_resize(o, 400, 200);
evas_object_show(o);
win->data = o;
}
#else
static void
_e_test_internal(E_Container *con)

319
src/bin/e_win.c Normal file
View File

@ -0,0 +1,319 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
/* local subsystem functions */
static void _e_win_free(E_Win *win);
static void _e_win_prop_update(E_Win *win);
static void _e_win_cb_move(Ecore_Evas *ee);
static void _e_win_cb_resize(Ecore_Evas *ee);
static void _e_win_cb_delete(Ecore_Evas *ee);
/* local subsystem globals */
static Evas_List *wins = NULL;
/* externally accessible functions */
int
e_win_init(void)
{
}
int
e_win_shutdown(void)
{
/*
while (wins)
{
e_object_del(E_OBJECT(wins->data));
}
*/
}
E_Win *
e_win_new(E_Container *con)
{
E_Win *win;
win = E_OBJECT_ALLOC(E_Win, E_WIN_TYPE, _e_win_free);
if (!win) return NULL;
win->container = con;
if (e_canvas_engine_decide(e_config->evas_engine_errors) ==
E_EVAS_ENGINE_GL_X11)
{
win->ecore_evas = ecore_evas_gl_x11_new(NULL, con->manager->root,
0, 0, 1, 1);
win->evas_win = ecore_evas_gl_x11_window_get(win->ecore_evas);
}
else
{
win->ecore_evas = ecore_evas_software_x11_new(NULL, con->manager->root,
0, 0, 1, 1);
win->evas_win = ecore_evas_software_x11_window_get(win->ecore_evas);
}
ecore_evas_data_set(win->ecore_evas, "E_Win", win);
ecore_evas_callback_move_set(win->ecore_evas, _e_win_cb_move);
ecore_evas_callback_resize_set(win->ecore_evas, _e_win_cb_resize);
ecore_evas_callback_delete_request_set(win->ecore_evas, _e_win_cb_delete);
win->evas = ecore_evas_get(win->ecore_evas);
e_canvas_add(win->ecore_evas);
ecore_evas_name_class_set(win->ecore_evas, "E", "_e_internal_window");
ecore_evas_title_set(win->ecore_evas, "E");
win->x = 0;
win->y = 0;
win->w = 1;
win->h = 1;
win->placed = 0;
win->min_w = 0;
win->min_h = 0;
win->max_w = 9999;
win->max_h = 9999;
win->base_w = 0;
win->base_h = 0;
win->step_x = 1;
win->step_y = 1;
win->min_aspect = 0.0;
win->max_aspect = 0.0;
wins = evas_list_append(wins, win);
return win;
}
void
e_win_show(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
if (!win->border)
{
_e_win_prop_update(win);
win->border = e_border_new(win->container, win->evas_win, 1);
if (!win->placed)
win->border->re_manage = 0;
win->border->internal = 1;
}
e_border_show(win->border);
ecore_evas_show(win->ecore_evas);
}
void
e_win_hide(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
if (win->border) e_border_hide(win->border, 1);
}
void
e_win_move(E_Win *win, int x, int y)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
if (win->border)
e_border_move(win->border,
x - win->border->client_inset.l,
y - win->border->client_inset.t);
else
ecore_evas_move(win->ecore_evas, x, y);
}
void
e_win_resize(E_Win *win, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
if (win->border)
e_border_resize(win->border,
w + win->border->client_inset.l + win->border->client_inset.r,
h + win->border->client_inset.t + win->border->client_inset.b);
else
ecore_evas_resize(win->ecore_evas, w, h);
}
void
e_win_move_resize(E_Win *win, int x, int y, int w, int h)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
if (win->border)
e_border_move_resize(win->border,
x - win->border->client_inset.l,
y - win->border->client_inset.t,
w + win->border->client_inset.l + win->border->client_inset.r,
h + win->border->client_inset.t + win->border->client_inset.b);
else
ecore_evas_move_resize(win->ecore_evas, x, y, w, h);
}
void
e_win_raise(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
if (win->border)
e_border_raise(win->border);
}
void
e_win_lower(E_Win *win)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
if (win->border)
e_border_lower(win->border);
}
void
e_win_placed_set(E_Win *win, int placed)
{
E_OBJECT_CHECK(win);
E_OBJECT_TYPE_CHECK(win, E_WIN_TYPE);
win->placed = placed;
if (win->border)
_e_win_prop_update(win);
}
Evas *
e_win_evas_get(E_Win *win)
{
E_OBJECT_CHECK_RETURN(win, NULL);
E_OBJECT_TYPE_CHECK_RETURN(win, E_WIN_TYPE, NULL);
return win->evas;
}
void
e_win_move_callback_set(E_Win *win, void (*func) (E_Win *win))
{
win->cb_move = func;
}
void
e_win_resize_callback_set(E_Win *win, void (*func) (E_Win *win))
{
win->cb_resize = func;
}
void
e_win_delete_callback_set(E_Win *win, void (*func) (E_Win *win))
{
win->cb_delete = func;
}
void
e_win_shaped_set(E_Win *win, int shaped)
{
ecore_evas_shaped_set(win->ecore_evas, shaped);
}
void
e_win_avoid_damage_set(E_Win *win, int avoid)
{
ecore_evas_avoid_damage_set(win->ecore_evas, avoid);
}
void
e_win_borderless_set(E_Win *win, int borderless)
{
ecore_evas_borderless_set(win->ecore_evas, borderless);
}
void
e_win_size_min_set(E_Win *win, int w, int h)
{
win->min_w = w;
win->min_h = h;
if (win->border)
_e_win_prop_update(win);
}
void
e_win_size_max_set(E_Win *win, int w, int h)
{
win->max_w = w;
win->max_h = h;
if (win->border)
_e_win_prop_update(win);
}
void
e_win_size_base_set(E_Win *win, int w, int h)
{
win->base_w = w;
win->base_h = h;
if (win->border)
_e_win_prop_update(win);
}
void
e_win_step_set(E_Win *win, int x, int y)
{
win->step_x = x;
win->step_y = y;
if (win->border)
_e_win_prop_update(win);
}
void
e_win_name_class_set(E_Win *win, char *name, char *class)
{
ecore_evas_name_class_set(win->ecore_evas, name, class);
}
void
e_win_title_set(E_Win *win, char *title)
{
ecore_evas_title_set(win->ecore_evas, title);
}
/* local subsystem functions */
static void
_e_win_free(E_Win *win)
{
e_canvas_del(win->ecore_evas);
ecore_evas_free(win->ecore_evas);
if (win->border) e_object_del(E_OBJECT(win->border));
wins = evas_list_remove(wins, win);
free(win);
}
static void
_e_win_prop_update(E_Win *win)
{
ecore_x_icccm_size_pos_hints_set(win->evas_win,
win->placed, ECORE_X_GRAVITY_NW,
win->min_w, win->min_h,
win->max_w, win->max_h,
win->base_w, win->base_h,
win->step_x, win->step_y,
win->min_aspect, win->max_aspect);
}
static void
_e_win_cb_move(Ecore_Evas *ee)
{
E_Win *win;
win = ecore_evas_data_get(ee, "E_Win");
if (!win) return;
if (win->cb_move) win->cb_move(win);
}
static void
_e_win_cb_resize(Ecore_Evas *ee)
{
E_Win *win;
win = ecore_evas_data_get(ee, "E_Win");
if (!win) return;
ecore_evas_geometry_get(win->ecore_evas, &win->x, &win->y, &win->w, &win->h);
if (win->cb_resize) win->cb_resize(win);
}
static void
_e_win_cb_delete(Ecore_Evas *ee)
{
E_Win *win;
win = ecore_evas_data_get(ee, "E_Win");
if (!win) return;
if (win->cb_delete) win->cb_delete(win);
}

60
src/bin/e_win.h Normal file
View File

@ -0,0 +1,60 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
typedef struct _E_Win E_Win;
#else
#ifndef E_WIN_H
#define E_WIN_H
#define E_WIN_TYPE 0xE0b01011
struct _E_Win
{
E_Object e_obj_inherit;
int x, y, w, h;
E_Container *container;
E_Border *border;
Ecore_Evas *ecore_evas;
Evas *evas;
Ecore_X_Window evas_win;
unsigned char placed : 1;
int min_w, min_h, max_w, max_h, base_w, base_h;
int step_x, step_y;
double min_aspect, max_aspect;
void (*cb_move) (E_Win *win);
void (*cb_resize) (E_Win *win);
void (*cb_delete) (E_Win *win);
void *data;
};
EAPI int e_win_init (void);
EAPI int e_win_shutdown (void);
EAPI E_Win *e_win_new (E_Container *con);
EAPI void e_win_show (E_Win *win);
EAPI void e_win_hide (E_Win *win);
EAPI void e_win_move (E_Win *win, int x, int y);
EAPI void e_win_resize (E_Win *win, int w, int h);
EAPI void e_win_move_resize (E_Win *win, int x, int y, int w, int h);
EAPI void e_win_raise (E_Win *win);
EAPI void e_win_lower (E_Win *win);
EAPI void e_win_placed_set (E_Win *win, int placed);
EAPI Evas *e_win_evas_get (E_Win *win);
EAPI void e_win_shaped_set (E_Win *win, int shaped);
EAPI void e_win_avoid_damage_set (E_Win *win, int avoid);
EAPI void e_win_borderless_set (E_Win *win, int borderless);
EAPI void e_win_move_callback_set (E_Win *win, void (*func) (E_Win *win));
EAPI void e_win_resize_callback_set(E_Win *win, void (*func) (E_Win *win));
EAPI void e_win_delete_callback_set(E_Win *win, void (*func) (E_Win *win));
EAPI void e_win_size_min_set (E_Win *win, int w, int h);
EAPI void e_win_size_max_set (E_Win *win, int w, int h);
EAPI void e_win_size_base_set (E_Win *win, int w, int h);
EAPI void e_win_step_set (E_Win *win, int x, int y);
EAPI void e_win_name_class_set (E_Win *win, char *name, char *class);
EAPI void e_win_title_set (E_Win *win, char *title);
#endif
#endif

View File

@ -368,8 +368,10 @@ _e_winlist_border_add(E_Border *bd, E_Zone *zone, E_Desk *desk)
{
if (bd->desk != desk)
{
if ((bd->zone) && (bd->zone != zone) &&
(!e_config->winlist_list_show_other_screen_windows)) ok = 0;
if ((bd->zone) && (bd->zone != zone))
{
if (!e_config->winlist_list_show_other_screen_windows) ok = 0;
}
else if (!e_config->winlist_list_show_other_desk_windows) ok = 0;
}
}