summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-03 15:34:42 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-03 15:36:00 +0100
commitbf2538897b68ba9d616d59cfe20e54fc92e81b8d (patch)
tree42bd36d549c1771627963519ae620f172a78de15
parent09df69a3eb23309dedf109f6daac3480f3175515 (diff)
ecore_evas_x - fix maximize/unmaximize request corner case
state was not managed well.. this will fix that. also a test in elementary for it to you can test it out. @fix
-rw-r--r--src/bin/elementary/test_win_state.c38
-rw-r--r--src/modules/ecore_evas/engines/x/ecore_evas_x.c19
2 files changed, 46 insertions, 11 deletions
diff --git a/src/bin/elementary/test_win_state.c b/src/bin/elementary/test_win_state.c
index f1b9af34cc..1b75d3d835 100644
--- a/src/bin/elementary/test_win_state.c
+++ b/src/bin/elementary/test_win_state.c
@@ -227,6 +227,22 @@ _bt_win_center_cb(void *data, Evas_Object *obj EINA_UNUSED,
227} 227}
228 228
229static void 229static void
230_bt_win_maximize(void *data, Evas_Object *obj EINA_UNUSED,
231 void *event_info EINA_UNUSED)
232{
233 printf("Maximize\n");
234 elm_win_maximized_set(data, EINA_TRUE);
235}
236
237static void
238_bt_win_unmaximize(void *data, Evas_Object *obj EINA_UNUSED,
239 void *event_info EINA_UNUSED)
240{
241 printf("Unmaximize\n");
242 elm_win_maximized_set(data, EINA_FALSE);
243}
244
245static void
230_win_state_print_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 246_win_state_print_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
231{ 247{
232 printf("WIN: %s\n", (char *)data); 248 printf("WIN: %s\n", (char *)data);
@@ -414,7 +430,7 @@ test_win_state(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
414 evas_object_show(bt); 430 evas_object_show(bt);
415 431
416 bt = elm_button_add(win); 432 bt = elm_button_add(win);
417 elm_object_text_set(bt, "Iconify and Activate"); 433 elm_object_text_set(bt, "Iconify + Act");
418 evas_object_smart_callback_add(bt, "clicked", 434 evas_object_smart_callback_add(bt, "clicked",
419 _bt_win_iconify_and_activate, win); 435 _bt_win_iconify_and_activate, win);
420 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); 436 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -423,7 +439,7 @@ test_win_state(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
423 evas_object_show(bt); 439 evas_object_show(bt);
424 440
425 bt = elm_button_add(bx2); 441 bt = elm_button_add(bx2);
426 elm_object_text_set(bt, "Iconify and Deiconify"); 442 elm_object_text_set(bt, "Iconify + De");
427 evas_object_smart_callback_add(bt, "clicked", 443 evas_object_smart_callback_add(bt, "clicked",
428 _bt_win_iconify_and_deiconify, win); 444 _bt_win_iconify_and_deiconify, win);
429 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); 445 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
@@ -431,6 +447,24 @@ test_win_state(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
431 elm_box_pack_end(bx2, bt); 447 elm_box_pack_end(bx2, bt);
432 evas_object_show(bt); 448 evas_object_show(bt);
433 449
450 bt = elm_button_add(bx2);
451 elm_object_text_set(bt, "Maximize");
452 evas_object_smart_callback_add(bt, "clicked",
453 _bt_win_maximize, win);
454 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
455 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
456 elm_box_pack_end(bx2, bt);
457 evas_object_show(bt);
458
459 bt = elm_button_add(bx2);
460 elm_object_text_set(bt, "Unmaximize");
461 evas_object_smart_callback_add(bt, "clicked",
462 _bt_win_unmaximize, win);
463 evas_object_size_hint_fill_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
464 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
465 elm_box_pack_end(bx2, bt);
466 evas_object_show(bt);
467
434 bt = elm_button_add(win); 468 bt = elm_button_add(win);
435 elm_object_text_set(bt, "Center"); 469 elm_object_text_set(bt, "Center");
436 evas_object_smart_callback_add(bt, "clicked", 470 evas_object_smart_callback_add(bt, "clicked",
diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
index 39cef2d608..91cd012388 100644
--- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c
+++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
@@ -3303,20 +3303,21 @@ _ecore_evas_x_maximized_set(Ecore_Evas *ee, Eina_Bool on)
3303{ 3303{
3304 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data; 3304 Ecore_Evas_Engine_Data_X11 *edata = ee->engine.data;
3305 3305
3306 if (ee->prop.maximized == on) return;
3307 ee->prop.maximized = 1;
3308 edata->state.maximized_h = 1;
3309 edata->state.maximized_v = 1;
3310// ee->prop.maximized = on;
3311 if (ee->should_be_visible) 3306 if (ee->should_be_visible)
3312 { 3307 {
3313 ecore_x_netwm_state_request_send(ee->prop.window, edata->win_root, 3308 ecore_x_netwm_state_request_send(ee->prop.window, edata->win_root,
3314 ECORE_X_WINDOW_STATE_MAXIMIZED_VERT, -1, on); 3309 ECORE_X_WINDOW_STATE_MAXIMIZED_VERT,
3315 ecore_x_netwm_state_request_send(ee->prop.window, edata->win_root, 3310 ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ,
3316 ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ, -1, on); 3311 on);
3317 } 3312 }
3318 else 3313 else
3319 _ecore_evas_x_state_update(ee); 3314 {
3315 if (ee->prop.maximized == on) return;
3316 ee->prop.maximized = on;
3317 edata->state.maximized_h = on;
3318 edata->state.maximized_v = on;
3319 _ecore_evas_x_state_update(ee);
3320 }
3320} 3321}
3321 3322
3322static void 3323static void