aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsebastid <sebastid>2005-11-04 23:30:18 +0000
committersebastid <sebastid@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2005-11-04 23:30:18 +0000
commit61e273d0df5de4a147e9b5be4e27ba55892d303e (patch)
tree60da6230b0f52ff356ab053307550a1c3b5ba196 /src
parentCorrect contains definition. (diff)
downloadenlightenment-61e273d0df5de4a147e9b5be4e27ba55892d303e.tar.gz
Fullscreen policy. Not tested since my stupid laptop only has one res.
Please test. SVN revision: 18303
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_border.c63
-rw-r--r--src/bin/e_border.h2
-rw-r--r--src/bin/e_config.c2
-rw-r--r--src/bin/e_config.h1
-rw-r--r--src/bin/e_desk.c2
-rw-r--r--src/bin/e_hints.c6
-rw-r--r--src/bin/e_int_border_menu.c2
-rw-r--r--src/bin/e_ipc_handlers.h51
-rw-r--r--src/bin/e_ipc_handlers_list.h5
9 files changed, 120 insertions, 14 deletions
diff --git a/src/bin/e_border.c b/src/bin/e_border.c
index 7515ac0f6..a8cfbbd78 100644
--- a/src/bin/e_border.c
+++ b/src/bin/e_border.c
@@ -111,6 +111,8 @@ static int grabbed = 0;
static Evas_List *focus_stack = NULL;
+static Ecore_X_Screen_Size screen_size = { -1, -1 };
+
int E_EVENT_BORDER_ADD = 0;
int E_EVENT_BORDER_REMOVE = 0;
int E_EVENT_BORDER_ZONE_SET = 0;
@@ -1591,16 +1593,11 @@ e_border_unmaximize(E_Border *bd)
}
}
void
-e_border_fullscreen(E_Border *bd)
+e_border_fullscreen(E_Border *bd, E_Fullscreen policy)
{
E_OBJECT_CHECK(bd);
E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE);
- /* FIXME:
- * Implement both fullscreen modes!
- * Black background!
- */
-
if ((bd->shaded) || (bd->shading)) return;
if (bd->maximized)
e_border_unmaximize(bd);
@@ -1639,7 +1636,53 @@ e_border_fullscreen(E_Border *bd)
y = y + (bd->zone->h - h) / 2;
e_border_move_resize(bd, x, y, w, h);
#endif
- e_border_move_resize(bd, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
+ if ((evas_list_count(bd->zone->container->zones) > 1) || (policy == E_FULLSCREEN_RESIZE))
+ {
+ e_border_move_resize(bd, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
+ }
+ else if (policy == E_FULLSCREEN_ZOOM)
+ {
+ Ecore_X_Screen_Size *sizes;
+ int num_sizes, i;
+
+ screen_size = ecore_x_randr_current_screen_size_get(bd->zone->container->manager->root);
+ sizes = ecore_x_randr_screen_sizes_get(bd->zone->container->manager->root, &num_sizes);
+ if (sizes)
+ {
+ Ecore_X_Screen_Size best_size = { -1, -1 };
+ int best_dist = INT_MAX, dist;
+
+ for (i = 0; i < num_sizes; i++)
+ {
+ if ((sizes[i].width > bd->w) && (sizes[i].height > bd->h))
+ {
+ dist = (sizes[i].width * sizes[i].height) - (bd->w * bd->h);
+ if (dist < best_dist)
+ {
+ best_size = sizes[i];
+ best_dist = dist;
+ }
+ }
+ }
+ if (((best_size.width != -1) && (best_size.height != -1)) &&
+ ((best_size.width != screen_size.width) ||
+ (best_size.height != screen_size.height)))
+ {
+ ecore_x_randr_screen_size_set(bd->zone->container->manager->root,
+ best_size);
+ e_border_move_resize(bd, 0, 0, best_size.width, best_size.height);
+ }
+ else
+ {
+ screen_size.width = -1;
+ screen_size.height = -1;
+ e_border_move_resize(bd, 0, 0, bd->zone->w, bd->zone->h);
+ }
+ free(sizes);
+ }
+ else
+ e_border_move_resize(bd, bd->zone->x, bd->zone->y, bd->zone->w, bd->zone->h);
+ }
ecore_evas_hide(bd->bg_ecore_evas);
bd->fullscreen = 1;
@@ -1667,6 +1710,12 @@ e_border_unfullscreen(E_Border *bd)
/* e_zone_fullscreen_set(bd->zone, 0); */
+ if ((screen_size.width != -1) && (screen_size.height != -1))
+ {
+ ecore_x_randr_screen_size_set(bd->zone->container->manager->root, screen_size);
+ screen_size.width = -1;
+ screen_size.height = -1;
+ }
e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h);
ecore_evas_show(bd->bg_ecore_evas);
diff --git a/src/bin/e_border.h b/src/bin/e_border.h
index 5808ac579..9bc634e71 100644
--- a/src/bin/e_border.h
+++ b/src/bin/e_border.h
@@ -504,7 +504,7 @@ EAPI void e_border_shade(E_Border *bd, E_Direction dir);
EAPI void e_border_unshade(E_Border *bd, E_Direction dir);
EAPI void e_border_maximize(E_Border *bd, E_Maximize max);
EAPI void e_border_unmaximize(E_Border *bd);
-EAPI void e_border_fullscreen(E_Border *bd);
+EAPI void e_border_fullscreen(E_Border *bd, E_Fullscreen policy);
EAPI void e_border_unfullscreen(E_Border *bd);
EAPI void e_border_iconify(E_Border *bd);
EAPI void e_border_uniconify(E_Border *bd);
diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index a34699d8e..0f8525c50 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -359,6 +359,7 @@ e_config_init(void)
E_CONFIG_VAL(D, T, menu_eap_name_show, INT); /**/
E_CONFIG_VAL(D, T, menu_eap_generic_show, INT); /**/
E_CONFIG_VAL(D, T, menu_eap_comment_show, INT); /**/
+ E_CONFIG_VAL(D, T, fullscreen_policy, INT); /**/
E_CONFIG_VAL(D, T, input_method, STR); /**/
E_CONFIG_LIST(D, T, path_append_input_methods, _e_config_path_append_edd); /**/
@@ -489,6 +490,7 @@ e_config_init(void)
e_config->menu_eap_name_show = 1;
e_config->menu_eap_generic_show = 1;
e_config->menu_eap_comment_show = 0;
+ e_config->fullscreen_policy = E_FULLSCREEN_RESIZE;
e_config->input_method = NULL;
{
diff --git a/src/bin/e_config.h b/src/bin/e_config.h
index d9627de7f..80c9a43d1 100644
--- a/src/bin/e_config.h
+++ b/src/bin/e_config.h
@@ -187,6 +187,7 @@ struct _E_Config
int menu_eap_name_show;
int menu_eap_generic_show;
int menu_eap_comment_show;
+ int fullscreen_policy;
};
struct _E_Config_Module
diff --git a/src/bin/e_desk.c b/src/bin/e_desk.c
index 07af1dbfd..1ecb5a267 100644
--- a/src/bin/e_desk.c
+++ b/src/bin/e_desk.c
@@ -219,7 +219,7 @@ e_desk_show(E_Desk *desk)
e_border_show(bd);
if (bd->want_fullscreen)
{
- e_border_fullscreen(bd);
+ e_border_fullscreen(bd, e_config->fullscreen_policy);
bd->want_fullscreen = 0;
}
}
diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c
index baa8dac86..b6d384234 100644
--- a/src/bin/e_hints.c
+++ b/src/bin/e_hints.c
@@ -449,7 +449,7 @@ e_hints_window_init(E_Border *bd)
if (!bd->lock_client_fullscreen)
{
e_hints_window_size_get(bd);
- e_border_fullscreen(bd);
+ e_border_fullscreen(bd, e_config->fullscreen_policy);
}
else
e_hints_window_fullscreen_set(bd, 0);
@@ -752,13 +752,13 @@ e_hints_window_state_update(E_Border *bd, Ecore_X_Window_State state,
e_border_unfullscreen(bd);
break;
case ECORE_X_WINDOW_STATE_ACTION_ADD:
- e_border_fullscreen(bd);
+ e_border_fullscreen(bd, e_config->fullscreen_policy);
break;
case ECORE_X_WINDOW_STATE_ACTION_TOGGLE:
if (bd->fullscreen)
e_border_unfullscreen(bd);
else
- e_border_fullscreen(bd);
+ e_border_fullscreen(bd, e_config->fullscreen_policy);
break;
}
break;
diff --git a/src/bin/e_int_border_menu.c b/src/bin/e_int_border_menu.c
index dc2f3881c..785adace2 100644
--- a/src/bin/e_int_border_menu.c
+++ b/src/bin/e_int_border_menu.c
@@ -538,7 +538,7 @@ _e_border_menu_cb_fullscreen(void *data, E_Menu *m, E_Menu_Item *mi)
{
toggle = e_menu_item_toggle_get(mi);
if (toggle)
- e_border_fullscreen(bd);
+ e_border_fullscreen(bd, e_config->fullscreen_policy);
else
e_border_unfullscreen(bd);
}
diff --git a/src/bin/e_ipc_handlers.h b/src/bin/e_ipc_handlers.h
index 7a30f3555..c5f055bdc 100644
--- a/src/bin/e_ipc_handlers.h
+++ b/src/bin/e_ipc_handlers.h
@@ -6857,3 +6857,54 @@ break;
#undef HDL
/****************************************************************************/
+#define HDL E_IPC_OP_FULLSCREEN_POLICY_SET
+#if (TYPE == E_REMOTE_OPTIONS)
+ OP("-fullscreen-policy-set", 1, "Set the fullscreen policy. OPT1 = RESIZE or ZOOM", 0, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+ REQ_INT_START(HDL)
+ int value = 0;
+ if (!strcmp(params[0], "RESIZE")) value = E_FULLSCREEN_RESIZE;
+ else if (!strcmp(params[0], "ZOOM")) value = E_FULLSCREEN_ZOOM;
+ else
+ {
+ printf("fullscreen must be RESIZE or ZOOM\n");
+ exit(-1);
+ }
+ REQ_INT_END(value, HDL);
+#elif (TYPE == E_WM_IN)
+ START_INT(value, HDL);
+ e_config->fullscreen_policy = value;
+ E_CONFIG_LIMIT(e_config->fullscreen_policy, E_FULLSCREEN_RESIZE, E_FULLSCREEN_ZOOM);
+ SAVE;
+ END_INT
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_FULLSCREEN_POLICY_GET
+#if (TYPE == E_REMOTE_OPTIONS)
+ OP("-fullscreen-policy-get", 0, "Get fullscreen policy", 1, HDL)
+#elif (TYPE == E_REMOTE_OUT)
+ REQ_NULL(HDL);
+#elif (TYPE == E_WM_IN)
+ SEND_INT(e_config->fullscreen_policy, E_IPC_OP_FULLSCREEN_POLICY_GET_REPLY, HDL);
+#elif (TYPE == E_REMOTE_IN)
+#endif
+#undef HDL
+
+/****************************************************************************/
+#define HDL E_IPC_OP_FULLSCREEN_POLICY_GET_REPLY
+#if (TYPE == E_REMOTE_OPTIONS)
+#elif (TYPE == E_REMOTE_OUT)
+#elif (TYPE == E_WM_IN)
+#elif (TYPE == E_REMOTE_IN)
+ START_INT(policy, HDL);
+ if (policy == E_FULLSCREEN_RESIZE)
+ printf("REPLY: RESIZE\n");
+ else if (policy == E_FULLSCREEN_ZOOM)
+ printf("REPLY: ZOOM\n");
+ END_INT
+#endif
+#undef HDL
+/****************************************************************************/
diff --git a/src/bin/e_ipc_handlers_list.h b/src/bin/e_ipc_handlers_list.h
index 4005c864e..442c2f61b 100644
--- a/src/bin/e_ipc_handlers_list.h
+++ b/src/bin/e_ipc_handlers_list.h
@@ -334,4 +334,7 @@
#define E_IPC_OP_IM_SET 317
#define E_IPC_OP_IM_GET 318
#define E_IPC_OP_IM_GET_REPLY 319
-
+
+#define E_IPC_OP_FULLSCREEN_POLICY_SET 320
+#define E_IPC_OP_FULLSCREEN_POLICY_GET 321
+#define E_IPC_OP_FULLSCREEN_POLICY_GET_REPLY 322