summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-11-10 16:59:58 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2013-07-06 12:09:15 +0100
commitcf471e9748cf46d019c1cd0aa72ea9197e67a07c (patch)
tree79756ea6cf39f183f9084452227c877c7e200f0a
parent80f35843a5efc04c81876fef439160a0c3ced6d6 (diff)
Make xcwm_window_t type opaque in API
Retire xcwm_window_sizing_t in favour of xcb_size_hints_t, which contains the full data it was being derived from
-rw-r--r--include/xcwm/window.h45
-rw-r--r--src/libxcwm/window.c20
-rw-r--r--src/libxcwm/xcwm_internal.h22
3 files changed, 40 insertions, 47 deletions
diff --git a/include/xcwm/window.h b/include/xcwm/window.h
index f6880df..3cea314 100644
--- a/include/xcwm/window.h
+++ b/include/xcwm/window.h
@@ -74,41 +74,6 @@ enum xcwm_window_state_t {
typedef enum xcwm_window_state_t xcwm_window_state_t;
/**
- * Structure defining min/max size for window and resizing
- * increments. A value of 0 in any field implies the field is unset.
- */
-struct xcwm_window_sizing_t {
- uint32_t min_width;
- uint32_t min_height;
- uint32_t max_width;
- uint32_t max_height;
- uint32_t width_inc;
- uint32_t height_inc;
-};
-typedef struct xcwm_window_sizing_t xcwm_window_sizing_t;
-
-/* Structure for holding data for a window */
-struct xcwm_window_t {
- xcb_drawable_t window_id;
- xcwm_context_t *context;
- xcwm_window_type_t type; /* The type of this window */
- struct xcwm_window_t *parent;
- struct xcwm_window_t *transient_for; /* Window this one is transient for */
- xcb_damage_damage_t damage;
- xcwm_rect_t *bounds;
- xcwm_rect_t *dmg_bounds;
- xcb_size_hints_t size_hints; /* WM_NORMAL_HINTS */
- xcwm_window_sizing_t *sizing; /* Sizing information for the window */
- char *name; /* The name of the window */
- int wm_delete_set; /* Flag for WM_DELETE_WINDOW, 1 if set */
- int override_redirect;
- int initial_damage; /* Set to 1 for override-redirect windows */
- void *local_data; /* Area for data client cares about */
- unsigned int opacity;
- xcb_pixmap_t composite_pixmap_id;
-};
-
-/**
* Set input focus to the window in context
* @param window The window to set focus to
*/
@@ -156,6 +121,14 @@ xcwm_window_configure(xcwm_window_t *window, int x, int y,
int width, int height);
/**
+ * Get the window's id
+ * @param window Window to get type for.
+ * @return The id of the window.
+ */
+xcb_window_t
+xcwm_window_get_window_id(xcwm_window_t const *window);
+
+/**
* Get the window's type.
* @param window Window to get type for.
* @return The type of the window.
@@ -241,7 +214,7 @@ xcwm_window_copy_name(xcwm_window_t const *window);
* @param window The window to get sizing data for.
* @return The structure containing the sizing data
*/
-xcwm_window_sizing_t const *
+xcb_size_hints_t const *
xcwm_window_get_sizing(xcwm_window_t const *window);
/**
diff --git a/src/libxcwm/window.c b/src/libxcwm/window.c
index 44121dd..2f9b53c 100644
--- a/src/libxcwm/window.c
+++ b/src/libxcwm/window.c
@@ -108,8 +108,6 @@ _xcwm_window_create(xcwm_context_t *context, xcb_window_t new_window,
assert(window->bounds);
window->dmg_bounds = malloc(sizeof(xcwm_rect_t));
assert(window->dmg_bounds);
- window->sizing = calloc(1, sizeof(*window->sizing));
- assert(window->dmg_bounds);;
/* set any available values from xcb_create_notify_event_t object pointer
and geom pointer */
@@ -276,7 +274,6 @@ _xcwm_window_release(xcwm_window_t *window)
}
free(window->bounds);
- free(window->sizing);
if (window->dmg_bounds) {
free(window->dmg_bounds);
}
@@ -288,6 +285,13 @@ _xcwm_window_release(xcwm_window_t *window)
/* Accessor functions into xcwm_window_t */
+xcb_window_t
+xcwm_window_get_window_id(xcwm_window_t const *window)
+{
+
+ return window->window_id;
+}
+
xcwm_window_type_t
xcwm_window_get_window_type(xcwm_window_t const *window)
{
@@ -364,16 +368,10 @@ xcwm_window_get_opacity(xcwm_window_t const *window)
return window->opacity;
}
-xcwm_window_sizing_t const *
+xcb_size_hints_t const *
xcwm_window_get_sizing(xcwm_window_t const *window)
{
- window->sizing->min_width = window->size_hints.min_width;
- window->sizing->min_height = window->size_hints.min_height;;
- window->sizing->max_width = window->size_hints.max_width;
- window->sizing->max_height = window->size_hints.max_height;
- window->sizing->width_inc = window->size_hints.width_inc;
- window->sizing->height_inc = window->size_hints.height_inc;
- return window->sizing;
+ return &window->size_hints;
}
void
diff --git a/src/libxcwm/xcwm_internal.h b/src/libxcwm/xcwm_internal.h
index b695eb5..4307008 100644
--- a/src/libxcwm/xcwm_internal.h
+++ b/src/libxcwm/xcwm_internal.h
@@ -71,6 +71,28 @@ struct xcwm_context_t {
};
/**
+ * Structure for holding data for a window
+ */
+struct xcwm_window_t {
+ xcb_drawable_t window_id;
+ xcwm_context_t *context;
+ xcwm_window_type_t type; /* The type of this window */
+ struct xcwm_window_t *parent;
+ struct xcwm_window_t *transient_for; /* Window this one is transient for */
+ xcb_damage_damage_t damage;
+ xcwm_rect_t *bounds;
+ xcwm_rect_t *dmg_bounds;
+ xcb_size_hints_t size_hints; /* WM_NORMAL_HINTS */
+ char *name; /* The name of the window */
+ int wm_delete_set; /* Flag for WM_DELETE_WINDOW, 1 if set */
+ int override_redirect;
+ int initial_damage; /* Set to 1 for override-redirect windows */
+ void *local_data; /* Area for data client cares about */
+ unsigned int opacity;
+ xcb_pixmap_t composite_pixmap_id;
+};
+
+/**
* Local data type for image data.
*/
typedef struct image_data_t image_data_t;