]> Pileus Git - ~andy/gtk/commitdiff
x11: Fold xsettings-common.[ch] into xsettings-client.[ch]
authorBenjamin Otte <otte@redhat.com>
Sun, 10 Feb 2013 00:06:58 +0000 (01:06 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 19 Feb 2013 13:32:41 +0000 (14:32 +0100)
gdk/x11/Makefile.am
gdk/x11/xsettings-client.c
gdk/x11/xsettings-client.h
gdk/x11/xsettings-common.c [deleted file]
gdk/x11/xsettings-common.h [deleted file]

index 255a8727d8b5ef57c17858cc794ac4aa8f1d6c85..a00118eae728e7b2b6e659cebb75fa639f06820c 100644 (file)
@@ -53,9 +53,7 @@ libgdk_x11_la_SOURCES =       \
        gdkx.h                  \
        gdkprivate-x11.h        \
        xsettings-client.h      \
-       xsettings-client.c      \
-       xsettings-common.h      \
-       xsettings-common.c
+       xsettings-client.c
 
 libgdkinclude_HEADERS =        \
        gdkx.h
index 87b7b0d2e423b95265b6689aef0c085360ae0eb6..93d3bc1e5bc1c7132ac169e7ed5db284f5cb6637 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "xsettings-client.h"
 
+#include <glib.h>
+
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -574,3 +576,42 @@ xsettings_client_process_event (XSettingsClient *client,
   
   return False;
 }
+
+int
+xsettings_setting_equal (XSettingsSetting *setting_a,
+                        XSettingsSetting *setting_b)
+{
+  if (setting_a->type != setting_b->type)
+    return 0;
+
+  if (strcmp (setting_a->name, setting_b->name) != 0)
+    return 0;
+
+  switch (setting_a->type)
+    {
+    case XSETTINGS_TYPE_INT:
+      return setting_a->data.v_int == setting_b->data.v_int;
+    case XSETTINGS_TYPE_COLOR:
+      return (setting_a->data.v_color.red == setting_b->data.v_color.red &&
+             setting_a->data.v_color.green == setting_b->data.v_color.green &&
+             setting_a->data.v_color.blue == setting_b->data.v_color.blue &&
+             setting_a->data.v_color.alpha == setting_b->data.v_color.alpha);
+    case XSETTINGS_TYPE_STRING:
+      return strcmp (setting_a->data.v_string, setting_b->data.v_string) == 0;
+    }
+
+  return 0;
+}
+
+void
+xsettings_setting_free (XSettingsSetting *setting)
+{
+  if (setting->type == XSETTINGS_TYPE_STRING)
+    free (setting->data.v_string);
+
+  if (setting->name)
+    free (setting->name);
+  
+  free (setting);
+}
+
index 629e28079c9a0c04ccb44552dee27e8312e70d4d..348c68c734f005cf88043a8ebe750cab61ecbc69 100644 (file)
 #define XSETTINGS_CLIENT_H
 
 #include <X11/Xlib.h>
-#include "xsettings-common.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
+/* Renames for GDK inclusion */
+
+#define xsettings_client_destroy         _gdk_x11_xsettings_client_destroy
+#define xsettings_client_get_setting     _gdk_x11_xsettings_client_get_setting
+#define xsettings_client_new             _gdk_x11_xsettings_client_new
+#define xsettings_client_set_grab_func   _gdk_x11_xsettings_client_set_grab_func
+#define xsettings_client_set_ungrab_func _gdk_x11_xsettings_client_set_ungrab_func
+#define xsettings_client_process_event   _gdk_x11_xsettings_client_process_event
+#define xsettings_setting_equal          _gdk_x11_xsettings_setting_equal
+#define xsettings_setting_free           _gdk_x11_xsettings_setting_free
+
+typedef struct _XSettingsBuffer  XSettingsBuffer;
+typedef struct _XSettingsColor   XSettingsColor;
+typedef struct _XSettingsSetting XSettingsSetting;
 typedef struct _XSettingsClient XSettingsClient;
 
+/* Types of settings possible. Enum values correspond to
+ * protocol values.
+ */
+typedef enum 
+{
+  XSETTINGS_TYPE_INT     = 0,
+  XSETTINGS_TYPE_STRING  = 1,
+  XSETTINGS_TYPE_COLOR   = 2
+} XSettingsType;
+
 typedef enum 
 {
   XSETTINGS_ACTION_NEW,
@@ -39,6 +62,41 @@ typedef enum
   XSETTINGS_ACTION_DELETED
 } XSettingsAction;
 
+typedef enum
+{
+  XSETTINGS_SUCCESS,
+  XSETTINGS_NO_MEM,
+  XSETTINGS_ACCESS,
+  XSETTINGS_FAILED,
+  XSETTINGS_NO_ENTRY,
+  XSETTINGS_DUPLICATE_ENTRY
+} XSettingsResult;
+
+struct _XSettingsBuffer
+{
+  char byte_order;
+  size_t len;
+  unsigned char *data;
+  unsigned char *pos;
+};
+
+struct _XSettingsColor
+{
+  unsigned short red, green, blue, alpha;
+};
+
+struct _XSettingsSetting
+{
+  char *name;
+  XSettingsType type;
+  
+  union {
+    int v_int;
+    char *v_string;
+    XSettingsColor v_color;
+  } data;
+};
+
 typedef void (*XSettingsNotifyFunc) (const char       *name,
                                     XSettingsAction   action,
                                     XSettingsSetting *setting,
@@ -49,6 +107,10 @@ typedef Bool (*XSettingsWatchFunc)  (Window            window,
                                     void             *cb_data);
 typedef void (*XSettingsGrabFunc)   (Display          *display);
 
+void              xsettings_setting_free          (XSettingsSetting    *setting);
+int               xsettings_setting_equal         (XSettingsSetting    *setting_a,
+                                                  XSettingsSetting    *setting_b);
+
 XSettingsClient *xsettings_client_new             (Display             *display,
                                                   int                  screen,
                                                   XSettingsNotifyFunc  notify,
diff --git a/gdk/x11/xsettings-common.c b/gdk/x11/xsettings-common.c
deleted file mode 100644 (file)
index d8f3d37..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright © 2001 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Red Hat not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  Red Hat makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author:  Owen Taylor, Red Hat, Inc.
- */
-
-#include "config.h"
-
-#include "xsettings-common.h"
-
-#include "string.h"
-#include "stdlib.h"
-
-#include <X11/Xlib.h>
-#include <X11/Xmd.h>           /* For CARD32 */
-
-int
-xsettings_setting_equal (XSettingsSetting *setting_a,
-                        XSettingsSetting *setting_b)
-{
-  if (setting_a->type != setting_b->type)
-    return 0;
-
-  if (strcmp (setting_a->name, setting_b->name) != 0)
-    return 0;
-
-  switch (setting_a->type)
-    {
-    case XSETTINGS_TYPE_INT:
-      return setting_a->data.v_int == setting_b->data.v_int;
-    case XSETTINGS_TYPE_COLOR:
-      return (setting_a->data.v_color.red == setting_b->data.v_color.red &&
-             setting_a->data.v_color.green == setting_b->data.v_color.green &&
-             setting_a->data.v_color.blue == setting_b->data.v_color.blue &&
-             setting_a->data.v_color.alpha == setting_b->data.v_color.alpha);
-    case XSETTINGS_TYPE_STRING:
-      return strcmp (setting_a->data.v_string, setting_b->data.v_string) == 0;
-    }
-
-  return 0;
-}
-
-void
-xsettings_setting_free (XSettingsSetting *setting)
-{
-  if (setting->type == XSETTINGS_TYPE_STRING)
-    free (setting->data.v_string);
-
-  if (setting->name)
-    free (setting->name);
-  
-  free (setting);
-}
-
diff --git a/gdk/x11/xsettings-common.h b/gdk/x11/xsettings-common.h
deleted file mode 100644 (file)
index e90471b..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright © 2001 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Red Hat not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission.  Red Hat makes no representations about the
- * suitability of this software for any purpose.  It is provided "as is"
- * without express or implied warranty.
- *
- * RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author:  Owen Taylor, Red Hat, Inc.
- */
-#ifndef XSETTINGS_COMMON_H
-#define XSETTINGS_COMMON_H
-
-#include <glib.h>
-#include <sys/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-/* Renames for GDK inclusion */
-
-#define xsettings_client_destroy         _gdk_x11_xsettings_client_destroy
-#define xsettings_client_get_setting     _gdk_x11_xsettings_client_get_setting
-#define xsettings_client_new             _gdk_x11_xsettings_client_new
-#define xsettings_client_set_grab_func   _gdk_x11_xsettings_client_set_grab_func
-#define xsettings_client_set_ungrab_func _gdk_x11_xsettings_client_set_ungrab_func
-#define xsettings_client_process_event   _gdk_x11_xsettings_client_process_event
-#define xsettings_setting_equal          _gdk_x11_xsettings_setting_equal
-#define xsettings_setting_free           _gdk_x11_xsettings_setting_free
-
-typedef struct _XSettingsBuffer  XSettingsBuffer;
-typedef struct _XSettingsColor   XSettingsColor;
-typedef struct _XSettingsSetting XSettingsSetting;
-
-/* Types of settings possible. Enum values correspond to
- * protocol values.
- */
-typedef enum 
-{
-  XSETTINGS_TYPE_INT     = 0,
-  XSETTINGS_TYPE_STRING  = 1,
-  XSETTINGS_TYPE_COLOR   = 2
-} XSettingsType;
-
-typedef enum
-{
-  XSETTINGS_SUCCESS,
-  XSETTINGS_NO_MEM,
-  XSETTINGS_ACCESS,
-  XSETTINGS_FAILED,
-  XSETTINGS_NO_ENTRY,
-  XSETTINGS_DUPLICATE_ENTRY
-} XSettingsResult;
-
-struct _XSettingsBuffer
-{
-  char byte_order;
-  size_t len;
-  unsigned char *data;
-  unsigned char *pos;
-};
-
-struct _XSettingsColor
-{
-  unsigned short red, green, blue, alpha;
-};
-
-struct _XSettingsSetting
-{
-  char *name;
-  XSettingsType type;
-  
-  union {
-    int v_int;
-    char *v_string;
-    XSettingsColor v_color;
-  } data;
-};
-
-void              xsettings_setting_free  (XSettingsSetting *setting);
-int               xsettings_setting_equal (XSettingsSetting *setting_a,
-                                          XSettingsSetting *setting_b);
-
-#define XSETTINGS_PAD(n,m) ((n + m - 1) & (~(m-1)))
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* XSETTINGS_COMMON_H */