Merge branch 'upstream' into tizen 54/254554/2
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>
Thu, 4 Mar 2021 09:55:38 +0000 (10:55 +0100)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Fri, 5 Mar 2021 11:26:01 +0000 (12:26 +0100)
Change-Id: I729b65879ba90b87ac04e71ab775656c0168868b

15 files changed:
1  2 
atspi/atspi-accessible.c
atspi/atspi-accessible.h
atspi/atspi-constants.h
atspi/atspi-event-listener.c
atspi/atspi-misc-private.h
atspi/atspi-misc.c
atspi/atspi-registry.c
atspi/atspi-types.h
bus/accessibility.conf.in
bus/at-spi-bus-launcher.c
bus/meson.build
meson.build
registryd/meson.build
registryd/ucs2keysym.c
test/meson.build

@@@ -2231,7 -1744,7 +2265,7 @@@ atspi_accessible_set_cache_mask (AtspiA
  {
    g_return_if_fail (accessible != NULL);
    g_return_if_fail (accessible->parent.app != NULL);
-   g_return_if_fail (atspi_accessible_is_equal (accessible, accessible->parent.app->root));
 -  g_return_if_fail (accessible == accessible->parent.app->root || accessible->role == ATSPI_ROLE_APPLICATION);
++  g_return_if_fail (atspi_accessible_is_equal (accessible, accessible->parent.app->root) || accessible->role == ATSPI_ROLE_APPLICATION);
    accessible->parent.app->cache = mask;
    enable_caching = TRUE;
  }
@@@ -101,9 -66,10 +101,10 @@@ struct _AtspiAccessibleClas
    AtspiObjectClass parent_class;
  
    void (*region_changed) (AtspiAccessible *accessible, gint current_offset, gint last_offset);
+   void (*mode_changed) (AtspiAccessible *accessible, gboolean enabled);
  };
  
 -GType atspi_accessible_get_type (void); 
 +GType atspi_accessible_get_type (void);
  
  AtspiAccessible *
  _atspi_accessible_new (AtspiApplication *app, const gchar *path);
@@@ -1396,28 -1397,8 +1410,28 @@@ typedef enum 
   *
   * One higher than the highest valid value of #AtspiRole.
   */
- #define ATSPI_ROLE_COUNT (127+1)
+ #define ATSPI_ROLE_COUNT (129+1)
  
 +/**
 + * AtspiMoveOutedType: The type of signal that occurs when an object outted the screen.
 + * @ATSPI_MOVE_OUTED_TOP_LEFT: Object has outted top or left of the screen.
 + * @ATSPI_MOVE_OUTED_BOTTOM_RIGHT: Object has outted bottom or right of the screen.
 + **/
 +
 +typedef enum {
 +    ATSPI_MOVE_OUTED_NULL,
 +    ATSPI_MOVE_OUTED_TOP_LEFT,
 +    ATSPI_MOVE_OUTED_BOTTOM_RIGHT,
 +    ATSPI_MOVE_OUTED_LAST_DEFINDED
 +} AtspiMoveOutedType;
 +
 +/**
 + * ATSPI_MOVE_OUTED_COUNT:
 + *
 + * One higher than the highest valid value of #AtspiScreenOuttedType.
 + **/
 +#define ATSPI_MOVE_OUTED_COUNT (3+1)
 +
  typedef enum
  {
       ATSPI_CACHE_NONE     = 0,
@@@ -1070,16 -1060,8 +1067,16 @@@ _atspi_dbus_handle_event (DBusConnectio
        accessible = _atspi_dbus_return_accessible_from_iter (&iter_variant);
          if (!strcmp (category, "ScreenReader"))
          {
-           g_object_unref(e.source);
+           g_object_unref (e.source);
            e.source = accessible;
 +          if (e.source == NULL)
 +          {
 +            g_warning ("Got no valid source accessible for signal %s from interface %s\n", member, category);
 +            g_free (converted_type);
 +            g_free (name);
 +            g_free (detail);
 +            return DBUS_HANDLER_RESULT_HANDLED;
 +          }
          }
          else
          {
Simple merge
  #include "atspi-gmain.h"
  #include <stdio.h>
  #include <string.h>
+ #include <ctype.h>
  
 +/* This value is not fixed, could be changed. */
 +#define HASH_TABLE_SIZE_MAX 1000
 +
  static void handle_get_items (DBusPendingCall *pending, void *user_data);
  
  static DBusConnection *bus = NULL;
Simple merge
Simple merge
@@@ -6,9 -6,11 +6,9 @@@
  <servicedir>@DATADIR@/dbus-1/accessibility-services</servicedir>
    <auth>EXTERNAL</auth>
  
-   <listen>unix:tmpdir=/tmp</listen>
+   <listen>unix:dir=/tmp</listen>
  
 -  <policy context="default">
 -    <!-- Allow root to connect -->
 -    <allow user="root"/>
 +  <policy user="owner">
      <!-- Allow everything to be sent -->
      <allow send_destination="*" eavesdrop="true"/>
      <!-- Allow everything to be received -->
  #include <X11/Xlib.h>
  #include <X11/Xatom.h>
  #endif
+ #ifdef DBUS_BROKER
+ #include <systemd/sd-login.h>
+ #endif
  
 +//TODO: move to vconf/vconf-internal-setting-keys.h?
 +#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_CONFIGURATION_SERVICE "db/setting/accessibility/universal-switch/configuration-service"
 +#define VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_INTERACTION_SERVICE "db/setting/accessibility/universal-switch/interaction-service"
 +
 +#define MAX_NUMBER_OF_KEYS_PER_CLIENT 2
 +
 +#define APP_CONTROL_OPERATION_SCREEN_READ "http://tizen.org/appcontrol/operation/read_screen"
 +#define APP_CONTROL_OPERATION_UNIVERSAL_SWITCH "http://tizen.org/appcontrol/operation/universal_switch"
 +#include <appsvc.h>
 +#include <vconf.h>
 +
 +//uncomment if you want debug
 +//#ifndef TIZEN_ENGINEER_MODE
 +//#define TIZEN_ENGINEER_MODE
 +//#endif
 +#ifdef LOG_TAG
 +#undef LOG_TAG
 +#endif
 +
 +#define LOG_TAG "ATSPI_BUS_LAUNCHER"
 +
 +#include <dlog.h>
 +#include <aul.h>
 +
 +//uncomment this if you want log suring startup
 +//seems like dlog is not working at startup time
 +#define ATSPI_BUS_LAUNCHER_LOG_TO_FILE
 +
 +#ifdef ATSPI_BUS_LAUNCHER_LOG_TO_FILE
 +FILE *log_file;
 +#ifdef LOGD
 +#undef LOGD
 +#endif
 +#define LOGD(arg...) do {if (log_file) {fprintf(log_file, ##arg);fprintf(log_file, "\n"); fflush(log_file);}} while(0)
 +#endif
 +
 +static gboolean _launch_process_repeat_until_success(gpointer user_data);
 +
  typedef enum {
    A11Y_BUS_STATE_IDLE = 0,
    A11Y_BUS_STATE_READING_ADDRESS,
@@@ -447,33 -401,31 +465,47 @@@ ensure_a11y_bus_broker (A11yBusLaunche
    GPid pid;
    GError *error = NULL;
  
+   /* This detects whether we are running under systemd. We only try to
+    * use dbus-broker if we are running under systemd because D-Bus
+    * service activation won't work otherwise.
+    */
+   if (sd_pid_get_user_unit (getpid (), &unit) >= 0)
+     {
+       free (unit);
+     }
+   else
+     {
+       app->state = A11Y_BUS_STATE_ERROR;
+       return FALSE;
+     }
    if ((app->listenfd = socket (PF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0)) < 0)
 -    g_error ("Failed to create listening socket: %s", strerror (errno));
 +    {
 +      char buf[4096] = { 0 };
 +      strerror_r (errno, buf, sizeof(buf));
 +      g_error ("Failed to create listening socket: %s", buf);
 +    }
  
    if (bind (app->listenfd, (struct sockaddr *)&addr, sizeof(sa_family_t)) < 0)
 -    g_error ("Failed to bind listening socket: %s", strerror (errno));
 +    {
 +      char buf[4096] = { 0 };
 +      strerror_r (errno, buf, sizeof(buf));
 +      g_error ("Failed to bind listening socket: %s", buf);
 +    }
  
    if (getsockname (app->listenfd, (struct sockaddr *)&addr, &addr_len) < 0)
 -    g_error ("Failed to get socket name for listening socket: %s", strerror(errno));
 +    {
 +      char buf[4096] = { 0 };
 +      strerror_r (errno, buf, sizeof(buf));
 +      g_error ("Failed to get socket name for listening socket: %s", buf);
 +    }
  
    if (listen (app->listenfd, 1024) < 0)
 -    g_error ("Failed to listen on socket: %s", strerror(errno));
 +    {
 +      char buf[4096] = { 0 };
 +      strerror_r (errno, buf, sizeof(buf));
 +      g_error ("Failed to listen on socket: %s", buf);
 +    }
  
    g_clear_pointer (&app->a11y_launch_error_message, g_free);
  
diff --cc bus/meson.build
@@@ -67,10 -65,15 +66,16 @@@ if get_option('default_bus') == 'dbus-b
    launcher_args += '-DWANT_DBUS_BROKER'
  endif
  
+ if needs_systemd
+   systemd_dep = dependency('libsystemd')
+ else
+   systemd_dep = dependency('', required: false)
+ endif
  executable('at-spi-bus-launcher', 'at-spi-bus-launcher.c',
             include_directories: [ root_inc, include_directories('.') ],
-            dependencies: [ gio_dep, x11_deps, app_svc_dep ],
 -           dependencies: [ gio_dep, systemd_dep, x11_deps ],
++           dependencies: [ gio_dep, systemd_dep, x11_deps, app_svc_dep ],
             c_args: launcher_args,
 +           link_args: '-pie',
             install: true,
             install_dir: atspi_libexecdir)
diff --cc meson.build
@@@ -45,10 -44,9 +45,10 @@@ endi
  
  # Dependencies
  libdbus_req_version = '>= 1.5'
- glib_req_version = '>= 2.32.0'
+ glib_req_version = '>= 2.62.0'
  gobject_req_version = '>= 2.0.0'
  gio_req_version = '>= 2.28.0'
 +app_svc_req_version = '>= 0.0.0'
  
  libdbus_dep = dependency('dbus-1', version: libdbus_req_version)
  glib_dep = dependency('glib-2.0', version: glib_req_version)
Simple merge
   * This software is in the public domain. Share and enjoy!
   *
   */
 -
 +#ifdef HAVE_X11
  #include <X11/X.h>
 +#endif
  #include "deviceeventcontroller.h"    /* for prototype */
  
+ /* DO NOT UPATE BY HAND!
+  * This table can be regenerated from Xorg's keysymdef.h with the ucs2keysym.sh
+  * script.  */
  struct codepair {
    unsigned short keysym;
    unsigned short ucs;
@@@ -1,16 -1,13 +1,24 @@@
- test('memory',
-      executable('memory', 'memory.c',
-                 include_directories: root_inc,
-                 dependencies: [ atspi_dep ]))
 +at_spi2_tool_sources = [ 
 +  'at_spi2_tool.c'
 +]
 +
 +executable('at_spi2_tool', at_spi2_tool_sources,
 +           dependencies: [ atspi_dep, gio_dep ],
 +           c_args: '-fPIE',
 +           link_args: '-pie',
 +           install: true,
 +           install_dir: atspi_bindir)
 +
+ testapp = executable('test-application',
+                      'test-application.c',
+                      include_directories: root_inc,
+                      dependencies: [ atspi_dep ],
+                     )
+ memory = executable('memory',
+                     'memory.c',
+                     include_directories: root_inc,
+                     dependencies: [ atspi_dep ],
+                    )
+ test('memory', memory, depends: testapp)