summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-11-21 15:48:09 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-11-23 13:04:13 +0900
commit5f6673f623b26822e5e8008e69df41b4b10596cd (patch)
treea29d86f07ce7cdf235b40ea4846b27c6796df066
parentc31a70a4f58f1fd796ea32c23204b9ae7ee8b6b2 (diff)
win: Implement unresizable mode (fixed size windows)
This sends a signal to the CSD frame to hide the bottom bar and disable the resize borders.
-rw-r--r--data/elementary/themes/edc/elm/border.edc46
-rw-r--r--src/bin/elementary/test_win_dialog.c4
-rw-r--r--src/lib/elementary/efl_ui_win.c28
3 files changed, 53 insertions, 25 deletions
diff --git a/data/elementary/themes/edc/elm/border.edc b/data/elementary/themes/edc/elm/border.edc
index ccf0dd2..481dc93 100644
--- a/data/elementary/themes/edc/elm/border.edc
+++ b/data/elementary/themes/edc/elm/border.edc
@@ -480,10 +480,20 @@ group { name: "elm/border/base/default";
480 color: 0 0 0 0; 480 color: 0 0 0 0;
481 } 481 }
482 } 482 }
483 rect { "elm.event.resize.tl"; 483 rect { "top_resize_clip";
484 clip: "top_clip"; 484 clip: "top_clip";
485 desc { "default"; 485 desc { "default";
486 rel.to: "top_clip"; 486 rel.to: "top_clip";
487 }
488 desc { "hidden";
489 inherit: "default";
490 hid;
491 }
492 }
493 rect { "elm.event.resize.tl";
494 clip: "top_resize_clip";
495 desc { "default";
496 rel.to: "top_clip";
487 rel2.relative: 0.0 0.0; 497 rel2.relative: 0.0 0.0;
488 min: 32 4; 498 min: 32 4;
489 align: 0.0 0.0; 499 align: 0.0 0.0;
@@ -493,7 +503,7 @@ group { name: "elm/border/base/default";
493 desc { "hidden"; inherit: "default"; hid; } 503 desc { "hidden"; inherit: "default"; hid; }
494 } 504 }
495 rect { "elm.event.resize.t"; 505 rect { "elm.event.resize.t";
496 clip: "top_clip"; 506 clip: "top_resize_clip";
497 desc { "default"; 507 desc { "default";
498 rel1.relative: 1.0 0.0; 508 rel1.relative: 1.0 0.0;
499 rel1.to_y: "top_clip"; 509 rel1.to_y: "top_clip";
@@ -509,7 +519,7 @@ group { name: "elm/border/base/default";
509 desc { "hidden"; inherit: "default"; hid; } 519 desc { "hidden"; inherit: "default"; hid; }
510 } 520 }
511 rect { "elm.event.resize.tr"; 521 rect { "elm.event.resize.tr";
512 clip: "top_clip"; 522 clip: "top_resize_clip";
513 desc { "default"; 523 desc { "default";
514 rel.to: "top_clip"; 524 rel.to: "top_clip";
515 rel1.relative: 1.0 0.0; 525 rel1.relative: 1.0 0.0;
@@ -613,8 +623,9 @@ group { name: "elm/border/base/default";
613 } 623 }
614 } 624 }
615 625
616#define BORDERLESS 1 626#define BORDERLESS 1
617#define MAXIMIZED 2 627#define MAXIMIZED 2
628#define UNRESIZABLE 4
618#define SET_MODE(a) script { new m = get_int(border_mode); m |= (a); set_int(border_mode, m); eval_mode(m); } 629#define SET_MODE(a) script { new m = get_int(border_mode); m |= (a); set_int(border_mode, m); eval_mode(m); }
619#define UNSET_MODE(a) script { new m = get_int(border_mode); m &= ~(a); set_int(border_mode, m); eval_mode(m); } 630#define UNSET_MODE(a) script { new m = get_int(border_mode); m &= ~(a); set_int(border_mode, m); eval_mode(m); }
620 631
@@ -622,10 +633,12 @@ group { name: "elm/border/base/default";
622 script { 633 script {
623 public border_mode; 634 public border_mode;
624 public eval_mode(m) { 635 public eval_mode(m) {
625 if (m & (BORDERLESS | MAXIMIZED)) { 636 if (m & (BORDERLESS | MAXIMIZED | UNRESIZABLE)) {
626 set_state(PART:"bottom_clip", "hidden", 0.0); 637 set_state(PART:"bottom_clip", "hidden", 0.0);
638 set_state(PART:"top_resize_clip", "hidden", 0.0);
627 } else { 639 } else {
628 set_state(PART:"bottom_clip", "default", 0.0); 640 set_state(PART:"bottom_clip", "default", 0.0);
641 set_state(PART:"top_resize_clip", "default", 0.0);
629 } 642 }
630 } 643 }
631 } 644 }
@@ -644,6 +657,14 @@ group { name: "elm/border/base/default";
644 } 657 }
645 program { "borderless,off"; UNSET_MODE(BORDERLESS); } 658 program { "borderless,off"; UNSET_MODE(BORDERLESS); }
646 program { 659 program {
660 signal: "elm,state,unresizable,on"; source: "elm";
661 SET_MODE(UNRESIZABLE);
662 }
663 program {
664 signal: "elm,state,unresizable,off"; source: "elm";
665 UNSET_MODE(UNRESIZABLE);
666 }
667 program {
647 signal: "elm,state,shadow,on"; source: "elm"; 668 signal: "elm,state,shadow,on"; source: "elm";
648 action: STATE_SET "default"; 669 action: STATE_SET "default";
649 targets: "shadow_spacer" "shadow"; 670 targets: "shadow_spacer" "shadow";
@@ -748,11 +769,8 @@ group { name: "elm/border/base/default";
748 } 769 }
749 program { 770 program {
750 signal: "elm,state,maximize*"; source: "elm"; 771 signal: "elm,state,maximize*"; source: "elm";
751 action: STATE_SET "hidden"; 772 SET_MODE(MAXIMIZED);
752 targets: "elm.event.resize.t" "elm.event.resize.tl" "elm.event.resize.tr" "bottom_clip";
753 after: "maximized,on";
754 } 773 }
755 program { "maximized,on"; SET_MODE(MAXIMIZED); }
756 program { 774 program {
757 signal: "elm,state,unmaximize*"; source: "elm"; 775 signal: "elm,state,unmaximize*"; source: "elm";
758 action: STATE_SET "default"; 776 action: STATE_SET "default";
@@ -760,11 +778,8 @@ group { name: "elm/border/base/default";
760 } 778 }
761 program { 779 program {
762 signal: "elm,state,unmaximize*"; source: "elm"; 780 signal: "elm,state,unmaximize*"; source: "elm";
763 action: STATE_SET "default"; 781 UNSET_MODE(MAXIMIZED);
764 targets: "elm.event.resize.t" "elm.event.resize.tl" "elm.event.resize.tr" "bottom_clip";
765 after: "maximized,off";
766 } 782 }
767 program { "maximized,off"; UNSET_MODE(MAXIMIZED); }
768 783
769 /* application desktop menu */ 784 /* application desktop menu */
770 program { name: "show_menu"; 785 program { name: "show_menu";
@@ -843,7 +858,7 @@ group { name: "elm/border/base/default";
843 signal: "mouse,out"; source: "elm.event.resize.t"; 858 signal: "mouse,out"; source: "elm.event.resize.t";
844 action: SIGNAL_EMIT "elm,action,resize,hide" "elm.event.resize.t"; 859 action: SIGNAL_EMIT "elm,action,resize,hide" "elm.event.resize.t";
845 } 860 }
846 program { name: "resize_t_down"; 861 program {
847 signal: "mouse,down,1"; source: "elm.event.resize.t"; 862 signal: "mouse,down,1"; source: "elm.event.resize.t";
848 action: SIGNAL_EMIT "elm,action,resize,start" "elm.event.resize.t"; 863 action: SIGNAL_EMIT "elm,action,resize,start" "elm.event.resize.t";
849 } 864 }
@@ -914,6 +929,7 @@ group { name: "elm/border/base/default";
914 } 929 }
915} 930}
916 931
932#undef UNRESIZABLE
917#undef BORDERLESS 933#undef BORDERLESS
918#undef MAXIMIZED 934#undef MAXIMIZED
919#undef SET_MODE 935#undef SET_MODE
diff --git a/src/bin/elementary/test_win_dialog.c b/src/bin/elementary/test_win_dialog.c
index 448fb9e..a0924fd 100644
--- a/src/bin/elementary/test_win_dialog.c
+++ b/src/bin/elementary/test_win_dialog.c
@@ -42,8 +42,8 @@ _bt2_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_
42 42
43 lb = efl_add(EFL_UI_TEXT_CLASS, dia, 43 lb = efl_add(EFL_UI_TEXT_CLASS, dia,
44 efl_text_set(efl_added, "This is a non-resizable dialog."), 44 efl_text_set(efl_added, "This is a non-resizable dialog."),
45 efl_gfx_size_hint_min_set(efl_added, 200, 150), 45 efl_gfx_size_hint_min_set(efl_added, 300, 150),
46 efl_gfx_size_hint_max_set(efl_added, 200, 150), 46 efl_gfx_size_hint_max_set(efl_added, 300, 150),
47 efl_gfx_size_hint_weight_set(efl_added, 0, 0)); 47 efl_gfx_size_hint_weight_set(efl_added, 0, 0));
48 48
49 // Swallow in the label as the default content, this will make it visible. 49 // Swallow in the label as the default content, this will make it visible.
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 70f93d4..967064c 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -247,12 +247,14 @@ struct _Efl_Ui_Win_Data
247 Eina_Bool need_borderless : 1; 247 Eina_Bool need_borderless : 1;
248 Eina_Bool need_bg_solid : 1; 248 Eina_Bool need_bg_solid : 1;
249 Eina_Bool need_menu : 1; 249 Eina_Bool need_menu : 1;
250 Eina_Bool need_unresizable : 1;
250 Eina_Bool cur_borderless : 1; 251 Eina_Bool cur_borderless : 1;
251 Eina_Bool cur_shadow : 1; 252 Eina_Bool cur_shadow : 1;
252 Eina_Bool cur_focus : 1; 253 Eina_Bool cur_focus : 1;
253 Eina_Bool cur_maximized : 1; 254 Eina_Bool cur_maximized : 1;
254 Eina_Bool cur_bg_solid : 1; 255 Eina_Bool cur_bg_solid : 1;
255 Eina_Bool cur_menu : 1; 256 Eina_Bool cur_menu : 1;
257 Eina_Bool cur_unresizable : 1;
256 } csd; 258 } csd;
257 259
258 struct { 260 struct {
@@ -848,15 +850,15 @@ static void
848_elm_win_obj_callback_changed_size_hints(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 850_elm_win_obj_callback_changed_size_hints(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
849{ 851{
850 ELM_WIN_DATA_GET(data, sd); 852 ELM_WIN_DATA_GET(data, sd);
851 Evas_Coord w, h; 853 Evas_Coord minw, minh, maxw, maxh;
852 854
853 efl_gfx_size_hint_combined_min_get(obj, &w, &h); 855 efl_gfx_size_hint_combined_min_get(obj, &minw, &minh);
854 TRAP(sd, size_min_set, w, h); 856 efl_gfx_size_hint_max_get(obj, &maxw, &maxh);
857 if (maxw < 1) maxw = -1;
858 if (maxh < 1) maxh = -1;
855 859
856 evas_object_size_hint_max_get(obj, &w, &h); 860 TRAP(sd, size_min_set, minw, minh);
857 if (w < 1) w = -1; 861 TRAP(sd, size_max_set, maxw, maxh);
858 if (h < 1) h = -1;
859 TRAP(sd, size_max_set, w, h);
860} 862}
861/* end of elm-win specific associate */ 863/* end of elm-win specific associate */
862 864
@@ -3254,6 +3256,7 @@ _elm_win_resize_objects_eval(Evas_Object *obj)
3254{ 3256{
3255 ELM_WIN_DATA_GET(obj, sd); 3257 ELM_WIN_DATA_GET(obj, sd);
3256 Evas_Coord w, h, minw, minh, maxw, maxh; 3258 Evas_Coord w, h, minw, minh, maxw, maxh;
3259 Eina_Bool unresizable;
3257 double wx, wy; 3260 double wx, wy;
3258 3261
3259 efl_gfx_size_hint_combined_min_get(sd->legacy.edje, &minw, &minh); 3262 efl_gfx_size_hint_combined_min_get(sd->legacy.edje, &minw, &minh);
@@ -3266,6 +3269,13 @@ _elm_win_resize_objects_eval(Evas_Object *obj)
3266 if (!wy) maxh = minh; 3269 if (!wy) maxh = minh;
3267 else maxh = 32767; 3270 else maxh = 32767;
3268 3271
3272 unresizable = ((minw == maxw) && (minh == maxh));
3273 if (sd->csd.need_unresizable != unresizable)
3274 {
3275 sd->csd.need_unresizable = unresizable;
3276 _elm_win_frame_style_update(sd, 0, 1);
3277 }
3278
3269 if (sd->frame_obj) 3279 if (sd->frame_obj)
3270 { 3280 {
3271 int fw, fh; 3281 int fw, fh;
@@ -4098,7 +4108,7 @@ _elm_win_frame_add(Efl_Ui_Win_Data *sd, const char *style)
4098static void 4108static void
4099_elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool calc) 4109_elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool calc)
4100{ 4110{
4101 Eina_Bool borderless, maximized, shadow, focus, bg_solid, menu; 4111 Eina_Bool borderless, maximized, shadow, focus, bg_solid, menu, unresizable;
4102 Eina_Bool changed = EINA_FALSE; 4112 Eina_Bool changed = EINA_FALSE;
4103 4113
4104 if (!sd->frame_obj) 4114 if (!sd->frame_obj)
@@ -4116,6 +4126,7 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool
4116 shadow = sd->csd.need_shadow && (!sd->fullscreen) && (!sd->maximized); 4126 shadow = sd->csd.need_shadow && (!sd->fullscreen) && (!sd->maximized);
4117 focus = ecore_evas_focus_get(sd->ee); 4127 focus = ecore_evas_focus_get(sd->ee);
4118 bg_solid = sd->csd.need_bg_solid; 4128 bg_solid = sd->csd.need_bg_solid;
4129 unresizable = sd->csd.need_unresizable;
4119 menu = sd->csd.need_menu; 4130 menu = sd->csd.need_menu;
4120 4131
4121#define STATE_SET(state, s1, s2) do { \ 4132#define STATE_SET(state, s1, s2) do { \
@@ -4132,6 +4143,7 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool
4132 STATE_SET(maximized, "elm,state,maximized", "elm,state,unmaximized"); 4143 STATE_SET(maximized, "elm,state,maximized", "elm,state,unmaximized");
4133 STATE_SET(focus, "elm,action,focus", "elm,action,unfocus"); 4144 STATE_SET(focus, "elm,action,focus", "elm,action,unfocus");
4134 STATE_SET(bg_solid, "elm,state,background,solid,on", "elm,state,background,solid,off"); 4145 STATE_SET(bg_solid, "elm,state,background,solid,on", "elm,state,background,solid,off");
4146 STATE_SET(unresizable, "elm,state,unresizable,on", "elm,state,unresizable,off");
4135 STATE_SET(menu, "elm,action,show_menu", "elm,action,hide_menu"); 4147 STATE_SET(menu, "elm,action,show_menu", "elm,action,hide_menu");
4136 4148
4137#undef STATE_SET 4149#undef STATE_SET