summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2020-10-13 15:19:39 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-10-13 15:19:39 +0100
commit25e64a9a4e3adc259e81093a223c12996e424bf1 (patch)
treef7b361e295588ad8e89f11b9480989aada1ef940 /src
parentb9df223fa2fb0c0293b3b28363030965e5acb9ff (diff)
Ecore_Win32: add the API ecore_win32_window_maximized_set()
Summary: ecore_evas win32 engine is updated to support it. This fixes the "maximized/unmaximized" elm "windows states" test. Test Plan: elm_test Reviewers: raster, jptiz, felipealmeida Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D12177
Diffstat (limited to 'src')
-rw-r--r--src/lib/ecore_win32/Ecore_Win32.h2
-rw-r--r--src/lib/ecore_win32/ecore_win32_private.h1
-rw-r--r--src/lib/ecore_win32/ecore_win32_window.c35
-rw-r--r--src/modules/ecore_evas/engines/win32/ecore_evas_win32.c45
4 files changed, 78 insertions, 5 deletions
diff --git a/src/lib/ecore_win32/Ecore_Win32.h b/src/lib/ecore_win32/Ecore_Win32.h
index fa5b80eb48..bb26a352d6 100644
--- a/src/lib/ecore_win32/Ecore_Win32.h
+++ b/src/lib/ecore_win32/Ecore_Win32.h
@@ -625,6 +625,8 @@ EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window,
625 625
626EAPI void ecore_win32_window_borderless_set(Ecore_Win32_Window *window, 626EAPI void ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
627 Eina_Bool on); 627 Eina_Bool on);
628EAPI void ecore_win32_window_maximized_set(Ecore_Win32_Window *window,
629 Eina_Bool on);
628 630
629EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, 631EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
630 Eina_Bool on); 632 Eina_Bool on);
diff --git a/src/lib/ecore_win32/ecore_win32_private.h b/src/lib/ecore_win32/ecore_win32_private.h
index 88d0e12afb..64304bb606 100644
--- a/src/lib/ecore_win32/ecore_win32_private.h
+++ b/src/lib/ecore_win32/ecore_win32_private.h
@@ -104,6 +104,7 @@ struct _Ecore_Win32_Window
104 unsigned int pointer_is_in : 1; 104 unsigned int pointer_is_in : 1;
105 unsigned int borderless : 1; 105 unsigned int borderless : 1;
106 unsigned int iconified : 1; 106 unsigned int iconified : 1;
107 unsigned int maximized : 1;
107 unsigned int fullscreen : 1; 108 unsigned int fullscreen : 1;
108 109
109 struct { 110 struct {
diff --git a/src/lib/ecore_win32/ecore_win32_window.c b/src/lib/ecore_win32/ecore_win32_window.c
index 2199d4a6df..914e0cf9ce 100644
--- a/src/lib/ecore_win32/ecore_win32_window.c
+++ b/src/lib/ecore_win32/ecore_win32_window.c
@@ -146,6 +146,7 @@ _ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
146 w->pointer_is_in = 0; 146 w->pointer_is_in = 0;
147 w->borderless = 0; 147 w->borderless = 0;
148 w->iconified = 0; 148 w->iconified = 0;
149 w->maximized = 0;
149 w->fullscreen = 0; 150 w->fullscreen = 0;
150 151
151 w->drag.x = x; 152 w->drag.x = x;
@@ -1360,6 +1361,37 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
1360} 1361}
1361 1362
1362/** 1363/**
1364 * @brief Maximize or restore the given window.
1365 *
1366 * @param window The window.
1367 * @param on @c EINA_TRUE for maximized window, @c EINA_FALSE to
1368 * restore it.
1369 *
1370 * This function maximizes @p window if @p on is set
1371 * to @c EINA_TRUE, or restores the window if it is set to
1372 * @c EINA_FALSE. If @p window is @c NULL or if the state
1373 * does not change (like setting to fullscreenmaximized the window is already
1374 * maximized), this function does nothing.
1375 *
1376 * @since 1.26
1377 */
1378EAPI void
1379ecore_win32_window_maximized_set(Ecore_Win32_Window *window,
1380 Eina_Bool on)
1381{
1382 if (!window) return;
1383
1384 if (((window->maximized) && (on)) ||
1385 ((!window->maximized) && (!on)))
1386 return;
1387
1388 INF("maximizing window: %s", on ? "yes" : "no");
1389
1390 ShowWindow(window->window, on ? SW_MAXIMIZE : SW_RESTORE);
1391 window->maximized = on;
1392}
1393
1394/**
1363 * @brief Set the given window to fullscreen. 1395 * @brief Set the given window to fullscreen.
1364 * 1396 *
1365 * @param window The window. 1397 * @param window The window.
@@ -1525,8 +1557,7 @@ ecore_win32_window_state_set(Ecore_Win32_Window *window,
1525 window->state.maximized_horz = 1; 1557 window->state.maximized_horz = 1;
1526 break; 1558 break;
1527 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED: 1559 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
1528 window->state.maximized_horz = 1; 1560 window->state.maximized = 1;
1529 window->state.maximized_vert = 1;
1530 break; 1561 break;
1531 case ECORE_WIN32_WINDOW_STATE_SHADED: 1562 case ECORE_WIN32_WINDOW_STATE_SHADED:
1532 window->state.shaded = 1; 1563 window->state.shaded = 1;
diff --git a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
index b159779940..623515da95 100644
--- a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
+++ b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
@@ -73,6 +73,7 @@ struct _Ecore_Evas_Engine_Data_Win32
73 { 73 {
74 unsigned char region : 1; 74 unsigned char region : 1;
75 unsigned char fullscreen : 1; 75 unsigned char fullscreen : 1;
76 unsigned char maximized : 1;
76 } state; 77 } state;
77}; 78};
78 79
@@ -434,9 +435,11 @@ _ecore_evas_win32_event_window_property_change(void *data EINA_UNUSED, int type
434{ 435{
435 struct { 436 struct {
436 struct { 437 struct {
438 unsigned char maximized : 1;
437 unsigned char fullscreen : 1; 439 unsigned char fullscreen : 1;
438 } win32; 440 } win32;
439 struct { 441 struct {
442 Eina_Bool maximized : 1;
440 Eina_Bool fullscreen : 1; 443 Eina_Bool fullscreen : 1;
441 } prop; 444 } prop;
442 } prev; 445 } prev;
@@ -456,12 +459,16 @@ _ecore_evas_win32_event_window_property_change(void *data EINA_UNUSED, int type
456 wdata = ee->engine.data; 459 wdata = ee->engine.data;
457 460
458 prev.win32.fullscreen = wdata->state.fullscreen; 461 prev.win32.fullscreen = wdata->state.fullscreen;
462 prev.win32.maximized = wdata->state.maximized;
459 463
460 prev.prop.fullscreen = ee->prop.fullscreen; 464 prev.prop.fullscreen = ee->prop.fullscreen;
465 prev.prop.maximized = ee->prop.maximized;
461 466
462 wdata->state.fullscreen = 0; 467 wdata->state.fullscreen = 0;
468 wdata->state.maximized = 0;
463 469
464 ee->prop.fullscreen = EINA_FALSE; 470 ee->prop.fullscreen = EINA_FALSE;
471 ee->prop.maximized = EINA_FALSE;
465 472
466 /* we get the states status */ 473 /* we get the states status */
467 ecore_win32_window_state_get(e->window, &state, &num); 474 ecore_win32_window_state_get(e->window, &state, &num);
@@ -475,6 +482,10 @@ _ecore_evas_win32_event_window_property_change(void *data EINA_UNUSED, int type
475 ee->prop.fullscreen = 1; 482 ee->prop.fullscreen = 1;
476 wdata->state.fullscreen = 1; 483 wdata->state.fullscreen = 1;
477 break; 484 break;
485 case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
486 ee->prop.maximized = 1;
487 wdata->state.maximized = 1;
488 break;
478 default: 489 default:
479 break; 490 break;
480 } 491 }
@@ -483,7 +494,9 @@ _ecore_evas_win32_event_window_property_change(void *data EINA_UNUSED, int type
483 } 494 }
484 495
485 if ((prev.win32.fullscreen != wdata->state.fullscreen) || 496 if ((prev.win32.fullscreen != wdata->state.fullscreen) ||
486 (prev.prop.fullscreen != ee->prop.fullscreen)) 497 (prev.prop.fullscreen != ee->prop.fullscreen) ||
498 (prev.win32.maximized != wdata->state.maximized) ||
499 (prev.prop.maximized != ee->prop.maximized))
487 { 500 {
488 if (ee->func.fn_state_change) 501 if (ee->func.fn_state_change)
489 ee->func.fn_state_change(ee); 502 ee->func.fn_state_change(ee);
@@ -508,6 +521,8 @@ _ecore_evas_win32_state_update(Ecore_Evas *ee)
508 state[num++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT; 521 state[num++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT;
509 if (ee->prop.maximized) 522 if (ee->prop.maximized)
510 state[num++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ; 523 state[num++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ;
524 if (ee->prop.maximized)
525 state[num++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED;
511// if (bd->client.netwm.state.shaded) 526// if (bd->client.netwm.state.shaded)
512// state[num++] = ECORE_WIN32_WINDOW_STATE_SHADED; 527// state[num++] = ECORE_WIN32_WINDOW_STATE_SHADED;
513 /* if (ee->prop.focus_skip) */ 528 /* if (ee->prop.focus_skip) */
@@ -832,7 +847,7 @@ _ecore_evas_win32_activate(Ecore_Evas *ee)
832 INF("ecore evas activate"); 847 INF("ecore evas activate");
833 848
834 ecore_evas_show(ee); 849 ecore_evas_show(ee);
835 ecore_win32_window_activate(ee->prop.window); 850 ecore_win32_window_activate((Ecore_Win32_Window *)ee->prop.window);
836} 851}
837 852
838static void 853static void
@@ -975,6 +990,30 @@ _ecore_evas_win32_override_set(Ecore_Evas *ee, Eina_Bool on)
975} 990}
976 991
977static void 992static void
993_ecore_evas_win32_maximized_set(Ecore_Evas *ee, Eina_Bool on)
994{
995 Ecore_Evas_Engine_Data_Win32 *wdata = ee->engine.data;
996
997 INF("ecore evas maximized set");
998
999 wdata->state.maximized = !!on;
1000 if (ee->should_be_visible)
1001 {
1002 struct _Ecore_Win32_Window *window;
1003
1004 window = (Ecore_Win32_Window *)ee->prop.window;
1005 ecore_win32_window_maximized_set(window, on);
1006 }
1007 else
1008 {
1009 if (ee->prop.maximized == on) return;
1010 ee->prop.maximized = on;
1011 wdata->state.maximized = on;
1012 _ecore_evas_win32_state_update(ee);
1013 }
1014}
1015
1016static void
978_ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) 1017_ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
979{ 1018{
980 Ecore_Evas_Engine_Data_Win32 *wdata = ee->engine.data; 1019 Ecore_Evas_Engine_Data_Win32 *wdata = ee->engine.data;
@@ -1373,7 +1412,7 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
1373 _ecore_evas_win32_iconified_set, 1412 _ecore_evas_win32_iconified_set,
1374 _ecore_evas_win32_borderless_set, 1413 _ecore_evas_win32_borderless_set,
1375 _ecore_evas_win32_override_set, 1414 _ecore_evas_win32_override_set,
1376 NULL, /* _ecore_evas_x_maximize_set */ 1415 _ecore_evas_win32_maximized_set,
1377 _ecore_evas_win32_fullscreen_set, 1416 _ecore_evas_win32_fullscreen_set,
1378 NULL, /* _ecore_evas_x_avoid_damage_set */ 1417 NULL, /* _ecore_evas_x_avoid_damage_set */
1379 NULL, /* _ecore_evas_x_withdrawn_set */ 1418 NULL, /* _ecore_evas_x_withdrawn_set */