devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=fd816230c448bbbcc13626f4f763f6d14c736df6

commit fd816230c448bbbcc13626f4f763f6d14c736df6
Author: Chris Michael <cpmich...@osg.samsung.com>
Date:   Mon Mar 14 13:19:13 2016 -0400

    make e_alert WBOD work in X11 even when built with wayland support
    
    If enlightenment is built with support for wayland, then previously
    the WBOD would not work if we were running the same binary with X11.
    This was because the alert system would try to connect via drm by
    default (due to wayland build option). We fix that by checking for the
    existance of $DISPLAY (as this will not be present under drm), and
    running the X11 codepath if it is found, running the drm codepath if
    it is not found.
    
    Signed-off-by: Chris Michael <cpmich...@osg.samsung.com>
---
 src/bin/e_alert_main.c | 55 ++++++++++++++++++++++----------------------------
 1 file changed, 24 insertions(+), 31 deletions(-)

diff --git a/src/bin/e_alert_main.c b/src/bin/e_alert_main.c
index bb86293..0df784c 100644
--- a/src/bin/e_alert_main.c
+++ b/src/bin/e_alert_main.c
@@ -16,14 +16,12 @@
 #include <xcb/shape.h>
 #include <X11/keysym.h>
 
-#ifdef HAVE_WAYLAND
 # ifdef HAVE_WL_DRM
 #  include <Ecore_Input.h>
 #  include <Ecore_Drm.h>
 #  include <Evas.h>
 #  include <Evas_Engine_Buffer.h>
 # endif
-#endif
 
 #define WINDOW_WIDTH   320
 #define WINDOW_HEIGHT  240
@@ -33,7 +31,6 @@
 #endif
 
 /* local function prototypes */
-#ifndef HAVE_WAYLAND
 static int           _e_alert_connect(void);
 static void          _e_alert_create(void);
 static void          _e_alert_display(void);
@@ -64,7 +61,6 @@ static xcb_gcontext_t gc = 0;
 static int fa = 0, fw = 0;
 static int sw = 0, sh = 0;
 static int fh = 0;
-#endif
 
 static const char *title = NULL, *str1 = NULL, *str2 = NULL;
 static int ret = 0, sig = 0;
@@ -85,10 +81,7 @@ struct
    { SIGABRT, "SIGABRT" }
 };
 
-#ifdef HAVE_WAYLAND
 # ifdef HAVE_WL_DRM
-static int fh = 0;
-static int sw = 0, sh = 0;
 static Ecore_Drm_Device *dev = NULL;
 static Ecore_Drm_Fb *buffer;
 static Evas *canvas = NULL;
@@ -487,7 +480,6 @@ _e_alert_drm_shutdown(void)
    ecore_drm_shutdown();
    evas_shutdown();
 }
-# endif
 #endif
 
 int
@@ -536,31 +528,34 @@ main(int argc, char **argv)
    str1 = "(F1) Recover";
    str2 = "(F12) Logout";
 
-#ifdef HAVE_WAYLAND
-# ifdef HAVE_WL_DRM
-   if (!_e_alert_drm_connect())
+#ifdef HAVE_WL_DRM
+   if (!getenv("DISPLAY"))
      {
-        printf("FAILED TO INIT ALERT SYSTEM!!!\n");
-        ecore_shutdown();
-        return EXIT_FAILURE;
+        if (!_e_alert_drm_connect())
+          {
+             printf("FAILED TO INIT ALERT SYSTEM!!!\n");
+             ecore_shutdown();
+             return EXIT_FAILURE;
+          }
+        _e_alert_drm_create();
+        _e_alert_drm_display();
+        _e_alert_drm_run();
+        _e_alert_drm_shutdown();
      }
-   _e_alert_drm_create();
-   _e_alert_drm_display();
-   _e_alert_drm_run();
-   _e_alert_drm_shutdown();
-# endif
-#else
-   if (!_e_alert_connect())
+   else
+#endif
      {
-        printf("FAILED TO INIT ALERT SYSTEM!!!\n");
-        ecore_shutdown();
-        return EXIT_FAILURE;
+        if (!_e_alert_connect())
+          {
+             printf("FAILED TO INIT ALERT SYSTEM!!!\n");
+             ecore_shutdown();
+             return EXIT_FAILURE;
+          }
+        _e_alert_create();
+        _e_alert_display();
+        _e_alert_run();
+        _e_alert_shutdown();
      }
-   _e_alert_create();
-   _e_alert_display();
-   _e_alert_run();
-   _e_alert_shutdown();
-#endif
 
    ecore_shutdown();
 
@@ -570,7 +565,6 @@ main(int argc, char **argv)
 }
 
 /* local functions */
-#ifndef HAVE_WAYLAND
 static int
 _e_alert_connect(void)
 {
@@ -1120,4 +1114,3 @@ _e_alert_draw_button_text(void)
 
    xcb_image_text_8(conn, strlen(str2), btn2, gc, x, (10 + fa), str2);
 }
-#endif

-- 


Reply via email to