diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/elementary/efl_ui_win.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 4904a13e10..87e7e9624d 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c | |||
@@ -5595,6 +5595,52 @@ _efl_ui_win_center(Eo *obj, Efl_Ui_Win_Data *sd, Eina_Bool h, Eina_Bool v) | |||
5595 | if ((trap) && (trap->center) && (!trap->center(sd->trap_data, obj, h, v))) | 5595 | if ((trap) && (trap->center) && (!trap->center(sd->trap_data, obj, h, v))) |
5596 | return; | 5596 | return; |
5597 | 5597 | ||
5598 | if (!efl_gfx_visible_get(obj)) | ||
5599 | { | ||
5600 | // Chose to use env var so this will also translate more easily | ||
5601 | // to wayland. yes - we can get x atoms to figure out if wm is | ||
5602 | // enlightenment, but this works just as well. for wl we'd need | ||
5603 | // an alternate wl specific way... this below works better IMHO | ||
5604 | const char *s = getenv("DESKTOP"); | ||
5605 | |||
5606 | if ((s) && (!strcasecmp(s, "Enlightenment"))) | ||
5607 | { | ||
5608 | #ifdef HAVE_ELEMENTARY_X | ||
5609 | if (sd->x.xwin) | ||
5610 | { | ||
5611 | static Ecore_X_Atom state = 0; | ||
5612 | static Ecore_X_Atom centered = 0; | ||
5613 | |||
5614 | if (!centered) centered = ecore_x_atom_get | ||
5615 | ("__E_ATOM_WINDOW_STATE_CENTERED"); | ||
5616 | if (!state) state = ecore_x_atom_get | ||
5617 | ("__E_ATOM_WINDOW_STATE"); | ||
5618 | ecore_x_window_prop_card32_set(sd->x.xwin, state, ¢ered, 1); | ||
5619 | } | ||
5620 | #endif | ||
5621 | // XXX: what to do with wayland? | ||
5622 | return; | ||
5623 | } | ||
5624 | // not e - fall back to manually placing on what we think the screen | ||
5625 | // is/will be... to do this move window to where pointer is first | ||
5626 | #ifdef HAVE_ELEMENTARY_X | ||
5627 | if (sd->x.xwin) | ||
5628 | { | ||
5629 | int x = 0, y = 0; | ||
5630 | |||
5631 | if (sd->req_wh) | ||
5632 | { | ||
5633 | win_w = sd->req_w; | ||
5634 | win_h = sd->req_h; | ||
5635 | } | ||
5636 | else evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h); | ||
5637 | ecore_x_pointer_root_xy_get(&x, &y); | ||
5638 | ecore_evas_move(sd->ee, x - (win_w / 2), y - (win_h / 2)); | ||
5639 | } | ||
5640 | #endif | ||
5641 | // XXX: what to do with wayland? | ||
5642 | } | ||
5643 | |||
5598 | ecore_evas_screen_geometry_get(sd->ee, | 5644 | ecore_evas_screen_geometry_get(sd->ee, |
5599 | &screen_x, &screen_y, | 5645 | &screen_x, &screen_y, |
5600 | &screen_w, &screen_h); | 5646 | &screen_w, &screen_h); |