diff options
author | Vincent Torri <vincent.torri@gmail.com> | 2017-04-26 07:10:21 +0200 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2017-04-26 15:07:34 +0900 |
commit | fd9ec9d1afe172e9142faf02a73ab3c5a70410e4 (patch) | |
tree | 01a096263f21b1879b35ee4b549e0519f47ce5c9 /src/lib/ecore_win32/ecore_win32_window.c | |
parent | 19797c96156ce2780b56de5f8e25d35fd94bd1cd (diff) |
Ecore_Win32: add ecore_win32_window_state_get() API to retrieve a window states
@feature
Diffstat (limited to 'src/lib/ecore_win32/ecore_win32_window.c')
-rw-r--r-- | src/lib/ecore_win32/ecore_win32_window.c | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/src/lib/ecore_win32/ecore_win32_window.c b/src/lib/ecore_win32/ecore_win32_window.c index 2ebd645329..f9629f735c 100644 --- a/src/lib/ecore_win32/ecore_win32_window.c +++ b/src/lib/ecore_win32/ecore_win32_window.c | |||
@@ -1530,6 +1530,97 @@ ecore_win32_window_state_set(Ecore_Win32_Window *window, | |||
1530 | } | 1530 | } |
1531 | } | 1531 | } |
1532 | 1532 | ||
1533 | /** | ||
1534 | * @brief Get the states of the given window. | ||
1535 | * | ||
1536 | * @param window The window to retrieve the state from. | ||
1537 | * @param state A pointer to an array of the states. | ||
1538 | * @param num A pointer to the number of states in the array. | ||
1539 | * | ||
1540 | * This function gets the states of @p window. @p state is a pointer to an array | ||
1541 | * of states of size @p num. If @p window is @c NULL, @p state and @p num must | ||
1542 | * not be @c NULL and point to respectively @c NULL and 0. | ||
1543 | * | ||
1544 | * @since 1.20 | ||
1545 | */ | ||
1546 | EAPI void | ||
1547 | ecore_win32_window_state_get(Ecore_Win32_Window *window, | ||
1548 | Ecore_Win32_Window_State **state, | ||
1549 | unsigned int *num) | ||
1550 | { | ||
1551 | Ecore_Win32_Window_State *st; | ||
1552 | unsigned int i; | ||
1553 | |||
1554 | *state = NULL; | ||
1555 | *num = 0; | ||
1556 | |||
1557 | if (!window) | ||
1558 | return; | ||
1559 | |||
1560 | INF("getting window state"); | ||
1561 | |||
1562 | i = 0; | ||
1563 | /* we get the number of states which are set */ | ||
1564 | if (window->state.iconified) | ||
1565 | i++; | ||
1566 | if (window->state.modal) | ||
1567 | i++; | ||
1568 | if (window->state.sticky) | ||
1569 | i++; | ||
1570 | if (window->state.maximized_vert) | ||
1571 | i++; | ||
1572 | if (window->state.maximized_horz) | ||
1573 | i++; | ||
1574 | if (window->state.maximized) | ||
1575 | i++; | ||
1576 | if (window->state.shaded) | ||
1577 | i++; | ||
1578 | if (window->state.hidden) | ||
1579 | i++; | ||
1580 | if (window->state.fullscreen) | ||
1581 | i++; | ||
1582 | if (window->state.above) | ||
1583 | i++; | ||
1584 | if (window->state.below) | ||
1585 | i++; | ||
1586 | if (window->state.demands_attention) | ||
1587 | i++; | ||
1588 | |||
1589 | st = (Ecore_Win32_Window_State *)malloc(i * sizeof(Ecore_Win32_Window_State)); | ||
1590 | if (!st) | ||
1591 | return; | ||
1592 | |||
1593 | *num = i; | ||
1594 | *state = st; | ||
1595 | |||
1596 | i = 0; | ||
1597 | |||
1598 | if (window->state.iconified) | ||
1599 | st[i++] = ECORE_WIN32_WINDOW_STATE_ICONIFIED; | ||
1600 | if (window->state.modal) | ||
1601 | st[i++] = ECORE_WIN32_WINDOW_STATE_MODAL; | ||
1602 | if (window->state.sticky) | ||
1603 | st[i++] = ECORE_WIN32_WINDOW_STATE_STICKY; | ||
1604 | if (window->state.maximized_vert) | ||
1605 | st[i++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT; | ||
1606 | if (window->state.maximized_horz) | ||
1607 | st[i++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ; | ||
1608 | if (window->state.maximized) | ||
1609 | st[i++] = ECORE_WIN32_WINDOW_STATE_MAXIMIZED; | ||
1610 | if (window->state.shaded) | ||
1611 | st[i++] = ECORE_WIN32_WINDOW_STATE_SHADED; | ||
1612 | if (window->state.hidden) | ||
1613 | st[i++] = ECORE_WIN32_WINDOW_STATE_HIDDEN; | ||
1614 | if (window->state.fullscreen) | ||
1615 | st[i++] = ECORE_WIN32_WINDOW_STATE_FULLSCREEN; | ||
1616 | if (window->state.above) | ||
1617 | st[i++] = ECORE_WIN32_WINDOW_STATE_ABOVE; | ||
1618 | if (window->state.below) | ||
1619 | st[i++] = ECORE_WIN32_WINDOW_STATE_BELOW; | ||
1620 | if (window->state.demands_attention) | ||
1621 | st[i++] = ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION; | ||
1622 | } | ||
1623 | |||
1533 | /** | 1624 | /** |
1534 | * @brief Apply the modification of the state to the given window. | 1625 | * @brief Apply the modification of the state to the given window. |
1535 | * | 1626 | * |