[Xfce4-commits] <libxfce4ui:new-sm-client> use unsigned char for SmPriority rather than char

Brian J. Tarricone noreply at xfce.org
Sat Sep 19 12:00:02 CEST 2009


Updating branch refs/heads/kelnos/new-sm-client
         to 95ff81a8fed053ca83742a865562d85e81211527 (commit)
       from 0b24f362fe3ed0176bca7a1b41256072ca1e14a9 (commit)

commit 95ff81a8fed053ca83742a865562d85e81211527
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Sat Sep 19 02:58:18 2009 -0700

    use unsigned char for SmPriority rather than char
    
    looking at the XSMP spec again, apparently CARD8 is an unsigned 8-bit
    integer, not signed... and xfce4-session treats it as unsigned too.

 docs/tmpl/xfce-sm-client.sgml |    1 +
 libxfce4ui/xfce-sm-client.c   |   35 ++++++++++++++++++-----------------
 libxfce4ui/xfce-sm-client.h   |    9 +++++----
 3 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/docs/tmpl/xfce-sm-client.sgml b/docs/tmpl/xfce-sm-client.sgml
index ef27ad5..78e8efb 100644
--- a/docs/tmpl/xfce-sm-client.sgml
+++ b/docs/tmpl/xfce-sm-client.sgml
@@ -115,6 +115,7 @@
 @XFCE_SM_CLIENT_PRIORITY_CORE: 
 @XFCE_SM_CLIENT_PRIORITY_DESKTOP: 
 @XFCE_SM_CLIENT_PRIORITY_DEFAULT: 
+ at XFCE_SM_CLIENT_PRIORITY_LOWEST: 
 
 <!-- ##### ENUM XfceSMClientRestartStyle ##### -->
 <para>
diff --git a/libxfce4ui/xfce-sm-client.c b/libxfce4ui/xfce-sm-client.c
index d5f266c..5c33fdc 100644
--- a/libxfce4ui/xfce-sm-client.c
+++ b/libxfce4ui/xfce-sm-client.c
@@ -93,8 +93,8 @@ typedef enum
 
 /**
  * XfceSMClientPriority:
- * @XFCE_SM_CLIENT_PRIORITY_HIGH: A relatively-high priority value.  You
- *                                probably don't want to use this.
+ * @XFCE_SM_CLIENT_PRIORITY_HIGHEST: A high priority value.  You probably
+ *                                   don't want to use this.
  * @XFCE_SM_CLIENT_PRIORITY_WM: A priority value for use by the window manager.
  * @XFCE_SM_CLIENT_PRIORITY_CORE: A priority value for use by applications that
  *                                place windows on the screen and possibly set
@@ -102,6 +102,7 @@ typedef enum
  * @XFCE_SM_CLIENT_PRIORITY_DESKTOP: A priority value for use by applications
  *                                   that draw on the desktop.
  * @XFCE_SM_CLIENT_PRIORITY_DEFAULT: A priority value for regular applications.
+ * @XFCE_SM_CLIENT_PRIORITY_LOWEST: The lowest possible priority value.
  *
  * Some sample priority values for use with xfce_sm_client_set_priority().
  **/
@@ -145,7 +146,7 @@ struct _XfceSMClient
     XfceSMClientState state;
     XfceSMClientRestartStyle restart_style;
 
-    gchar priority;
+    guchar priority;
 
     gchar *client_id;
 
@@ -378,11 +379,12 @@ xfce_sm_client_class_init(XfceSMClientClass *klass)
                                                       XFCE_SM_CLIENT_RESTART_NORMAL,
                                                       G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
     g_object_class_install_property(gobject_class, PROP_PRIORITY,
-                                    g_param_spec_char("priority",
-                                                      "Priority",
-                                                      "Determines the ordering in which this client is restarted",
-                                                      G_MININT8, G_MAXINT8, 50,
-                                                      G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
+                                    g_param_spec_uchar("priority",
+                                                       "Priority",
+                                                       "Determines the ordering in which this client is restarted",
+                                                       0, G_MAXUINT8,
+                                                       XFCE_SM_CLIENT_PRIORITY_DEFAULT,
+                                                       G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
     g_object_class_install_property(gobject_class, PROP_CLIENT_ID,
                                     g_param_spec_string("client-id",
                                                         "Client ID",
@@ -447,7 +449,7 @@ xfce_sm_client_get_property(GObject *obj,
             break;
 
         case PROP_PRIORITY:
-            g_value_set_char(value, sm_client->priority);
+            g_value_set_uchar(value, sm_client->priority);
             break;
 
         case PROP_CLIENT_ID:
@@ -488,7 +490,7 @@ xfce_sm_client_set_property(GObject *obj,
             break;
 
         case PROP_PRIORITY:
-            xfce_sm_client_set_priority(sm_client, g_value_get_char(value));
+            xfce_sm_client_set_priority(sm_client, g_value_get_uchar(value));
             break;
 
         case PROP_CLIENT_ID:
@@ -1461,7 +1463,7 @@ XfceSMClient *
 xfce_sm_client_get_with_argv(guint argc,
                              gchar **argv,
                              XfceSMClientRestartStyle restart_style,
-                             gchar priority)
+                             guchar priority)
 {
     return g_object_new(XFCE_TYPE_SM_CLIENT,
                         "argc", argc,
@@ -1495,7 +1497,7 @@ xfce_sm_client_get_with_argv(guint argc,
  **/
 XfceSMClient *
 xfce_sm_client_get_full(XfceSMClientRestartStyle restart_style,
-                        gchar priority,
+                        guchar priority,
                         const gchar *resumed_client_id,
                         const gchar *current_directory,
                         const gchar **restart_command)
@@ -1531,8 +1533,7 @@ xfce_sm_client_connect(XfceSMClient *sm_client,
     SmPropValue prop1val, prop2val, prop3val, prop4val, prop5val, prop6val, prop7val;
     int n_props = 0;
     char pid[32];
-    char hint = SmRestartIfRunning;
-    char priority = sm_client->priority;
+    unsigned char hint = SmRestartIfRunning;
     char *given_client_id = NULL;
 #endif
 
@@ -1648,7 +1649,7 @@ xfce_sm_client_connect(XfceSMClient *sm_client,
     prop6.type = SmCARD8;
     prop6.num_vals = 1;
     prop6.vals = &prop6val;
-    prop6val.value = &priority;
+    prop6val.value = &sm_client->priority;
     prop6val.length = 1;
     n_props++;
 
@@ -1925,7 +1926,7 @@ xfce_sm_client_set_restart_style(XfceSMClient *sm_client,
  **/
 void
 xfce_sm_client_set_priority(XfceSMClient *sm_client,
-                            gchar priority)
+                            guchar priority)
 {
     g_return_if_fail(XFCE_IS_SM_CLIENT(sm_client));
 
@@ -2065,7 +2066,7 @@ xfce_sm_client_get_restart_style(XfceSMClient *sm_client)
  *
  * Returns: a value from #G_MININT8 to #G_MAXINT8
  **/
-gchar
+guchar
 xfce_sm_client_get_priority(XfceSMClient *sm_client)
 {
     g_return_val_if_fail(XFCE_IS_SM_CLIENT(sm_client),
diff --git a/libxfce4ui/xfce-sm-client.h b/libxfce4ui/xfce-sm-client.h
index a8ed7ef..5625075 100644
--- a/libxfce4ui/xfce-sm-client.h
+++ b/libxfce4ui/xfce-sm-client.h
@@ -48,6 +48,7 @@ typedef enum
     XFCE_SM_CLIENT_PRIORITY_CORE = 25,
     XFCE_SM_CLIENT_PRIORITY_DESKTOP = 35,
     XFCE_SM_CLIENT_PRIORITY_DEFAULT = 50,
+    XFCE_SM_CLIENT_PRIORITY_LOWEST = 255,
 } XfceSMClientPriority;
 
 typedef enum
@@ -70,10 +71,10 @@ XfceSMClient *xfce_sm_client_get();
 XfceSMClient *xfce_sm_client_get_with_argv(guint argc,
                                            gchar **argv,
                                            XfceSMClientRestartStyle restart_style,
-                                           gchar priority);
+                                           guchar priority);
 
 XfceSMClient *xfce_sm_client_get_full(XfceSMClientRestartStyle restart_style,
-                                      gchar priority,
+                                      guchar priority,
                                       const gchar *resumed_client_id,
                                       const gchar *current_directory,
                                       const gchar **restart_command);
@@ -99,8 +100,8 @@ void xfce_sm_client_set_restart_style(XfceSMClient *sm_client,
 XfceSMClientRestartStyle xfce_sm_client_get_restart_style(XfceSMClient *sm_client);
 
 void xfce_sm_client_set_priority(XfceSMClient *sm_client,
-                                 gchar priority);
-gchar xfce_sm_client_get_priority(XfceSMClient *sm_client);
+                                 guchar priority);
+guchar xfce_sm_client_get_priority(XfceSMClient *sm_client);
 
 void xfce_sm_client_set_current_directory(XfceSMClient *sm_client,
                                           const gchar *current_directory);



More information about the Xfce4-commits mailing list