This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository lightdm-efl-greeter.
View the commit online.
commit b74a542bba44e09c7dc1c9dec362b1a72ba59192
Author: Swagtoy <m...@ow.swag.toys>
AuthorDate: Mon Jun 30 13:39:49 2025 -0400
Try to workaround EFL issue, polishing code
---
src/greeter.c | 82 ++++++++++++++++++++++++++++++++++++++++++++-------------
src/meson.build | 1 +
2 files changed, 64 insertions(+), 19 deletions(-)
diff --git a/src/greeter.c b/src/greeter.c
index a940374..e550bce 100644
--- a/src/greeter.c
+++ b/src/greeter.c
@@ -14,7 +14,7 @@
#include <gtk/gtkx.h>
#include <lightdm.h>
#include <stdbool.h>
-#include <X11/extensions/randr.h>
+#include <X11/extensions/Xrandr.h>
static void
show_message_cb(LightDMGreeter *ldm, const gchar *text, LightDMPromptType type);
@@ -233,6 +233,50 @@ glib_hack(void *data)
return ECORE_CALLBACK_RENEW;
}
+// TODO Upstream this
+void
+rootless_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, int *w, int *h, int *w_mm, int *h_mm, int *size_index)
+{
+ XRRScreenConfiguration *cfg = NULL;
+ Ecore_X_Display *_ecore_x_disp = ecore_x_display_get();
+ Ecore_X_Screen *screen = ecore_x_screen_get(0);
+
+ /* try to get the screen config from XRandr */
+ if ((cfg = XRRGetScreenInfo(_ecore_x_disp, root)))
+ {
+ XRRScreenSize *sizes;
+ Rotation crot = 0;
+ int n = 0;
+
+ /* retrieve the number of sizes from X, and the sizes themselves.
+ *
+ * NB: don't have to free the returned sizes */
+ sizes =
+ XRRSizes(_ecore_x_disp, ecore_x_screen_index_get(screen), &n);
+ if ((sizes) && (n > 0))
+ {
+ int idx = 0;
+
+ /* get the index of the current configuration */
+ idx = XRRConfigCurrentConfiguration(cfg, &crot);
+
+ /* if the index is valid, then fill in the return variables with
+ * the size information for this index */
+ if ((idx < n) && (idx >= 0))
+ {
+ if (w) *w = sizes[idx].width;
+ if (h) *h = sizes[idx].height;
+ if (w_mm) *w_mm = sizes[idx].mwidth;
+ if (h_mm) *h_mm = sizes[idx].mheight;
+ if (size_index) *size_index = idx;
+ }
+ }
+
+ /* free the returned screen config */
+ XRRFreeScreenConfigInfo(cfg);
+ }
+}
+
int
main(int argc, char **argv)
{
@@ -255,13 +299,10 @@ main(int argc, char **argv)
win =
E_SHOW(elm_win_util_standard_add("lightdm-efl-greeter-root", "Lightdm"));
- root = E_SHOW(elm_box_add(win));
- elm_box_padding_set(root, 12, 12);
- elm_box_homogeneous_set(root, EINA_FALSE);
+ root = E_SHOW(elm_table_add(win));
+ //elm_box_padding_set(root, 12, 12);
+ //elm_box_homogeneous_set(root, EINA_FALSE);
evas_object_size_hint_weight_set(root, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- //evas_object_size_hint_align_set(root, EVAS_HINT_FILL, EVAS_HINT_FILL);
- //evas_object_size_hint_weight_set(win, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- //evas_object_size_hint_align_set(win, EVAS_HINT_FILL, EVAS_HINT_FILL);
ob = E_SHOW(elm_box_add(win));
elm_box_horizontal_set(ob, EINA_TRUE);
@@ -269,6 +310,7 @@ main(int argc, char **argv)
evas_object_size_hint_weight_set(ob, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
elm_box_padding_set(ob, 5, 0);
o = E_SHOW(elm_label_add(win));
+ // XXX: Bad
elm_object_text_set(o, " Session:");
elm_box_pack_end(ob, o);
@@ -282,30 +324,32 @@ main(int argc, char **argv)
elm_hoversel_item_add(sessions, lightdm_session_get_name(session), NULL, ELM_ICON_NONE, session_set_cb, session);
}
elm_box_pack_end(ob, sessions);
- elm_box_pack_end(root, ob);
+ elm_table_pack(root, ob, 0, 0, 1, 1);
ob = E_SHOW(elm_box_add(win));
evas_object_size_hint_weight_set(ob, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ob, EVAS_HINT_FILL, EVAS_HINT_FILL);
o = E_SHOW(build_login_prompt(root));
- elm_box_pack_end(ob, o);
- elm_box_pack_end(root, ob);
- //evas_object_resize(o, 320, 200);
+ evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_table_pack(root, o, 0, 1, 1, 1);
// XXX: Should get monitor size, look at x_randr functions later, but this is easier for me
- int w = ELM_SCALE_SIZE(800), h = ELM_SCALE_SIZE(600), x, y, z;
+ int w = ELM_SCALE_SIZE(800), h = ELM_SCALE_SIZE(600);
+ Ecore_X_Window xwindow = elm_win_xwindow_get(win);
if (!no_lightdm)
- elm_win_screen_size_get(win, &w, &h, &x, &y);
- //ecore_x_randr_screen_primary_output_current_size_get(xwindow, &w, &h, &x, &y, NULL);
- evas_object_resize(win, w, h);
- elm_win_resize_object_add(win, root);
+ rootless_x_randr_screen_primary_output_current_size_get(xwindow, &w, &h, NULL, NULL, NULL);
- loop = g_main_loop_new(NULL, 0);
- ecore_timer_add(0.01, glib_hack, loop);
+ // TODO maybe not this?
+ //elm_win_resize_object_add(win, root);
+ evas_object_resize(root, w, h);
+ evas_object_resize(win, w, h);
+
+ //loop = g_main_loop_new(NULL, 0);
+ //ecore_timer_add(0.01, glib_hack, loop);
elm_run();
- g_main_loop_quit(loop);
+ //g_main_loop_quit(loop);
elm_shutdown();
return EXIT_SUCCESS;
}
diff --git a/src/meson.build b/src/meson.build
index 525610a..a5044f4 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -8,6 +8,7 @@ executable(meson.project_name(),
dependency('elementary', version: '>= 1.26.0'),
dependency('ecore', version: '>= 1.26.0'),
dependency('ecore-x', version: '>= 1.26.0'),
+ dependency('xrandr'),
meson.get_compiler('c').find_library('m')
],
install: true
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.