diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2017-08-04 16:17:53 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2017-08-04 16:17:33 -0400 |
commit | be20f7d96c4bc2d4c9a9f5dc6dbc754d0aafa881 (patch) | |
tree | 930bf8c34f220b74bd7eb866ec9ae1afbfe2886b /src/lib/efl_wl/efl_wl.c | |
parent | 70afe70c9ab9c20b2b41380b8d0e7f19e1d33fa0 (diff) |
efl-wl: support min/max hinting
@feature
Diffstat (limited to 'src/lib/efl_wl/efl_wl.c')
-rw-r--r-- | src/lib/efl_wl/efl_wl.c | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c index 2a78282372..575012e0e6 100644 --- a/src/lib/efl_wl/efl_wl.c +++ b/src/lib/efl_wl/efl_wl.c | |||
@@ -144,6 +144,7 @@ typedef struct Comp | |||
144 | Eina_Bool x11_selection : 1; | 144 | Eina_Bool x11_selection : 1; |
145 | Eina_Bool rtl : 1; | 145 | Eina_Bool rtl : 1; |
146 | Eina_Bool aspect : 1; | 146 | Eina_Bool aspect : 1; |
147 | Eina_Bool minmax : 1; | ||
147 | } Comp; | 148 | } Comp; |
148 | 149 | ||
149 | typedef struct Comp_Data_Device_Source Comp_Data_Device_Source; | 150 | typedef struct Comp_Data_Device_Source Comp_Data_Device_Source; |
@@ -1168,6 +1169,19 @@ shell_surface_activate_recurse(Comp_Surface *cs) | |||
1168 | } | 1169 | } |
1169 | 1170 | ||
1170 | static void | 1171 | static void |
1172 | shell_surface_minmax_update(Comp_Surface *cs) | ||
1173 | { | ||
1174 | int w, h; | ||
1175 | |||
1176 | if (!cs) return; | ||
1177 | if (!cs->c->minmax) return; | ||
1178 | evas_object_size_hint_min_get(cs->obj, &w, &h); | ||
1179 | evas_object_size_hint_min_set(cs->c->obj, w, h); | ||
1180 | evas_object_size_hint_max_get(cs->obj, &w, &h); | ||
1181 | evas_object_size_hint_max_set(cs->c->obj, w, h); | ||
1182 | } | ||
1183 | |||
1184 | static void | ||
1171 | shell_surface_aspect_update(Comp_Surface *cs) | 1185 | shell_surface_aspect_update(Comp_Surface *cs) |
1172 | { | 1186 | { |
1173 | Evas_Aspect_Control aspect; | 1187 | Evas_Aspect_Control aspect; |
@@ -1225,6 +1239,7 @@ shell_surface_send_configure(Comp_Surface *cs) | |||
1225 | if (ccs->shell.surface && ccs->role && ccs->shell.popup) | 1239 | if (ccs->shell.surface && ccs->role && ccs->shell.popup) |
1226 | ccs->shell.activated = cs->shell.activated; | 1240 | ccs->shell.activated = cs->shell.activated; |
1227 | shell_surface_aspect_update(cs); | 1241 | shell_surface_aspect_update(cs); |
1242 | shell_surface_minmax_update(cs); | ||
1228 | } | 1243 | } |
1229 | else | 1244 | else |
1230 | shell_surface_deactivate_recurse(cs); | 1245 | shell_surface_deactivate_recurse(cs); |
@@ -3080,10 +3095,25 @@ static void | |||
3080 | shell_surface_toplevel_move(){} | 3095 | shell_surface_toplevel_move(){} |
3081 | static void | 3096 | static void |
3082 | shell_surface_toplevel_resize(){} | 3097 | shell_surface_toplevel_resize(){} |
3098 | |||
3083 | static void | 3099 | static void |
3084 | shell_surface_toplevel_set_max_size(){} | 3100 | shell_surface_toplevel_set_max_size(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t w, int32_t h) |
3101 | { | ||
3102 | Comp_Surface *cs = wl_resource_get_user_data(resource); | ||
3103 | evas_object_size_hint_max_set(cs->obj, w, h); | ||
3104 | if (cs == cs->c->active_surface) | ||
3105 | shell_surface_minmax_update(cs); | ||
3106 | } | ||
3107 | |||
3085 | static void | 3108 | static void |
3086 | shell_surface_toplevel_set_min_size(){} | 3109 | shell_surface_toplevel_set_min_size(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, int32_t w, int32_t h) |
3110 | { | ||
3111 | Comp_Surface *cs = wl_resource_get_user_data(resource); | ||
3112 | evas_object_size_hint_min_set(cs->obj, w, h); | ||
3113 | if (cs == cs->c->active_surface) | ||
3114 | shell_surface_minmax_update(cs); | ||
3115 | } | ||
3116 | |||
3087 | static void | 3117 | static void |
3088 | shell_surface_toplevel_set_maximized(){} | 3118 | shell_surface_toplevel_set_maximized(){} |
3089 | static void | 3119 | static void |
@@ -5373,3 +5403,20 @@ efl_wl_aspect_set(Evas_Object *obj, Eina_Bool set) | |||
5373 | else | 5403 | else |
5374 | evas_object_size_hint_aspect_set(obj, EVAS_ASPECT_CONTROL_NONE, 0, 0); | 5404 | evas_object_size_hint_aspect_set(obj, EVAS_ASPECT_CONTROL_NONE, 0, 0); |
5375 | } | 5405 | } |
5406 | |||
5407 | void | ||
5408 | efl_wl_minmax_set(Evas_Object *obj, Eina_Bool set) | ||
5409 | { | ||
5410 | Comp *c; | ||
5411 | |||
5412 | if (!eina_streq(evas_object_type_get(obj), "comp")) abort(); | ||
5413 | c = evas_object_smart_data_get(obj); | ||
5414 | c->minmax = !!set; | ||
5415 | if (c->minmax) | ||
5416 | shell_surface_minmax_update(c->active_surface); | ||
5417 | else | ||
5418 | { | ||
5419 | evas_object_size_hint_min_set(obj, 0, 0); | ||
5420 | evas_object_size_hint_max_set(obj, -1, -1); | ||
5421 | } | ||
5422 | } | ||