summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2012-03-21 11:37:05 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2012-03-21 13:27:22 -0700
commit6d167230fa9ec8fd7e217b48b55b8bdeb446724a (patch)
treeb8040c76956b37479e29776f0e9c4f8d98915827
parent11b4cbc941f1ad308c3d5bf418aacc2b3e4f2f38 (diff)
API: Change namespace from xtoq_ to xcwm_
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--include/xcwm/xtoq.h79
-rw-r--r--src/libcompositewm/Makefile.am2
-rw-r--r--src/libcompositewm/context_list.c42
-rw-r--r--src/libcompositewm/data.h4
-rw-r--r--src/libcompositewm/event_loop.c48
-rw-r--r--src/libcompositewm/init.c20
-rw-r--r--src/libcompositewm/input.c24
-rw-r--r--src/libcompositewm/util.c24
-rw-r--r--src/libcompositewm/window.c60
-rw-r--r--src/libcompositewm/xcwm.c (renamed from src/libcompositewm/xtoq.c)94
-rw-r--r--src/libcompositewm/xcwm_internal.h (renamed from src/libcompositewm/xtoq_internal.h)78
-rw-r--r--src/xtoq/XtoqApplication.m2
-rw-r--r--src/xtoq/XtoqController.h22
-rw-r--r--src/xtoq/XtoqController.m82
-rw-r--r--src/xtoq/XtoqImageRep.h4
-rw-r--r--src/xtoq/XtoqImageRep.m4
-rw-r--r--src/xtoq/XtoqView.h4
-rw-r--r--src/xtoq/XtoqView.m12
-rw-r--r--src/xtoq/XtoqWindow.h10
-rw-r--r--src/xtoq/XtoqWindow.m8
20 files changed, 314 insertions, 309 deletions
diff --git a/include/xcwm/xtoq.h b/include/xcwm/xtoq.h
index bfede6e..ce37575 100644
--- a/include/xcwm/xtoq.h
+++ b/include/xcwm/xtoq.h
@@ -23,6 +23,11 @@
* SOFTWARE.
*/
+/* FIXME: This header needs to go away.
+ * Each subsystem should have its own header file. structs
+ * should not be API since that makes changes hard in the future.
+ * See event.h for an example.
+ */
#ifndef _XTOQ_H_
#define _XTOQ_H_
@@ -39,10 +44,10 @@
#include <xcb/xfixes.h>
#include <xcb/xcb_keysyms.h>
-/* Abstract types for xtoq data types */
+/* Abstract types for xcwm data types */
/* FIXME: Obfuscate these */
-struct xtoq_context_t {
+struct xcwm_context_t {
xcb_connection_t *conn;
xcb_drawable_t window;
xcb_window_t parent;
@@ -59,7 +64,7 @@ struct xtoq_context_t {
int wm_delete_set; /* Flag for WM_DELETE_WINDOW, 1 if set */
void *local_data; /* Area for data client cares about */
};
-typedef struct xtoq_context_t xtoq_context_t;
+typedef struct xcwm_context_t xcwm_context_t;
struct image_data_t {
uint8_t *data;
@@ -67,14 +72,14 @@ struct image_data_t {
};
typedef struct image_data_t image_data_t;
-struct xtoq_image_t {
+struct xcwm_image_t {
xcb_image_t *image;
int x;
int y;
int width;
int height;
};
-typedef struct xtoq_image_t xtoq_image_t;
+typedef struct xcwm_image_t xcwm_image_t;
/**
* Context which contains the display's root window.
@@ -82,131 +87,131 @@ typedef struct xtoq_image_t xtoq_image_t;
* FIXME: We should avoid having global state where at all possible, and
* certainly not export such state for client access
*/
-extern xtoq_context_t *root_context;
+extern xcwm_context_t *root_context;
/**
* Sets up the connection and grabs the root window from the specified screen
* @param display the display to connect to
* @return The root context which contains the root window
*/
-xtoq_context_t *
-xtoq_init(char *display);
+xcwm_context_t *
+xcwm_init(char *display);
/**
* Returns a window's entire image
- * @param an xtoq_context_t
+ * @param an xcwm_context_t
* FIXME: this might be for the root window
- * @return an xtoq_image_t with an the image of a window
+ * @return an xcwm_image_t with an the image of a window
*/
-xtoq_image_t *
-xtoq_get_image(xtoq_context_t *context);
+xcwm_image_t *
+xcwm_get_image(xcwm_context_t *context);
/**
* Intended for servicing to a client's reaction to a damage notification
* this window returns the modified subrectangle of a window
- * @param an xtoq_context_t of the damaged window
- * @return an xtoq_image_t with partial image window contents
+ * @param an xcwm_context_t of the damaged window
+ * @return an xcwm_image_t with partial image window contents
*/
-xtoq_image_t *
-test_xtoq_get_image(xtoq_context_t * context);
+xcwm_image_t *
+test_xcwm_get_image(xcwm_context_t * context);
/**
- * free the memory used by an xtoq_image_t created
- * during a call to test_xtoq_image_create
- * @param xtoq_image an image to be freed
+ * free the memory used by an xcwm_image_t created
+ * during a call to test_xcwm_image_create
+ * @param xcwm_image an image to be freed
*/
void
-xtoq_image_destroy(xtoq_image_t * xtoq_image);
+xcwm_image_destroy(xcwm_image_t * xcwm_image);
/**
* Set input focus to the window in context
* @param context The context containing the window
*/
void
-xtoq_set_input_focus(xtoq_context_t *context);
+xcwm_set_input_focus(xcwm_context_t *context);
/**
* Set a window to the bottom of the window stack.
* @param context The context containing the window
*/
void
-xtoq_set_window_to_bottom(xtoq_context_t *context);
+xcwm_set_window_to_bottom(xcwm_context_t *context);
/**
* Set a window to the top of the window stack.
* @param context The context containing the window
*/
void
-xtoq_set_window_to_top(xtoq_context_t *context);
+xcwm_set_window_to_top(xcwm_context_t *context);
/**
* Remove the damage from the given context.
* @param context The context to remove the damage from
*/
void
-xtoq_remove_context_damage(xtoq_context_t *context);
+xcwm_remove_context_damage(xcwm_context_t *context);
/**
* Closes the windows open on the X Server, the connection, and the event
* loop.
*/
void
-xtoq_close(void);
+xcwm_close(void);
/**
* function
- * @param context xtoq_context_t
+ * @param context xcwm_context_t
* @param window The window that the key press was made in.
* @param keyCode The key pressed.
*/
void
-xtoq_key_press (xtoq_context_t *context, int window, uint8_t code);
+xcwm_key_press (xcwm_context_t *context, int window, uint8_t code);
/**
* function
- * @param context xtoq_context_t
+ * @param context xcwm_context_t
* @param window The window that the key press was made in.
* @param keyCode The key released.
*/
void
-xtoq_key_release (xtoq_context_t *context, int window, uint8_t code);
+xcwm_key_release (xcwm_context_t *context, int window, uint8_t code);
/**
* Uses the XTEST protocol to send input events to the X Server (The X Server
* is usually in the position of sending input events to a client). The client
* will often choose to send coordinates through mouse motion and set the params
* x & y to 0 here.
- * @param context xtoq_context_t
+ * @param context xcwm_context_t
* @param x - x coordinate
* @param y - y coordinate
* @param window The window that the key press was made in.
*/
void
-xtoq_button_press (xtoq_context_t *context, long x, long y, int window, int button);
+xcwm_button_press (xcwm_context_t *context, long x, long y, int window, int button);
/**
* Uses the XTEST protocol to send input events to the X Server (The X Server
* is usually in the position of sending input events to a client). The client
* will often choose to send coordinates through mouse motion and set the params
* x & y to 0 here.
- * @param context xtoq_context_t
+ * @param context xcwm_context_t
* @param x - x coordinate
* @param y - y coordinate
* @param window The window that the key release was made in.
*/
void
-xtoq_button_release (xtoq_context_t *context, long x, long y, int window, int button);
+xcwm_button_release (xcwm_context_t *context, long x, long y, int window, int button);
/**
* function
- * @param context xtoq_context_t
+ * @param context xcwm_context_t
* @param x - x coordinate
* @param y - y coordinate
* @param window The window that the key release was made in.
*/
void
-xtoq_mouse_motion (xtoq_context_t *context, long x, long y, int window, int button);
+xcwm_mouse_motion (xcwm_context_t *context, long x, long y, int window, int button);
/****************
* window.c
@@ -218,7 +223,7 @@ xtoq_mouse_motion (xtoq_context_t *context, long x, long y, int window, int butt
* @param context The context of the window to be killed
*/
void
-xtoq_request_close(xtoq_context_t *context);
+xcwm_request_close(xcwm_context_t *context);
/**
* move and/or resize the window, update the context
@@ -229,6 +234,6 @@ xtoq_request_close(xtoq_context_t *context);
* @param width The new width
*/
void
-xtoq_configure_window(xtoq_context_t *context, int x, int y, int height, int width);
+xcwm_configure_window(xcwm_context_t *context, int x, int y, int height, int width);
#endif // _XTOQ_H_
diff --git a/src/libcompositewm/Makefile.am b/src/libcompositewm/Makefile.am
index b233cad..57fbf6a 100644
--- a/src/libcompositewm/Makefile.am
+++ b/src/libcompositewm/Makefile.am
@@ -13,5 +13,5 @@ libcompositewm_la_SOURCES = \
event_loop.c \
init.c \
util.c \
- xtoq.c \
+ xcwm.c \
input.c
diff --git a/src/libcompositewm/context_list.c b/src/libcompositewm/context_list.c
index 9a0c30a..89cd58c 100644
--- a/src/libcompositewm/context_list.c
+++ b/src/libcompositewm/context_list.c
@@ -23,47 +23,47 @@
* SOFTWARE.
*/
-#include "xtoq_internal.h"
+#include "xcwm_internal.h"
-_xtoq_context_node *_xtoq_window_list_head = NULL;
+_xcwm_context_node *_xcwm_window_list_head = NULL;
-xtoq_context_t *
-_xtoq_add_context_t(struct xtoq_context_t *context)
+xcwm_context_t *
+_xcwm_add_context_t(struct xcwm_context_t *context)
{
/* temp pointers for traversing */
- _xtoq_context_node *new_node;
- _xtoq_context_node *curr;
- _xtoq_context_node *prev;
+ _xcwm_context_node *new_node;
+ _xcwm_context_node *curr;
+ _xcwm_context_node *prev;
/* Create node to hold the new window */
- new_node = malloc(sizeof(_xtoq_context_node));
+ new_node = malloc(sizeof(_xcwm_context_node));
if (!new_node) {
exit(1);
}
new_node->context = context;
/* Handle the case where this is the first node added */
- if (!_xtoq_window_list_head) {
+ if (!_xcwm_window_list_head) {
new_node->prev = NULL;
new_node->next = NULL;
- _xtoq_window_list_head = new_node;
+ _xcwm_window_list_head = new_node;
} else {
/* Add the new node to the beginning of the list */
- new_node->next = _xtoq_window_list_head;
- _xtoq_window_list_head->prev = new_node;
+ new_node->next = _xcwm_window_list_head;
+ _xcwm_window_list_head->prev = new_node;
new_node->prev = NULL;
- _xtoq_window_list_head = new_node;
+ _xcwm_window_list_head = new_node;
}
return new_node->context;
}
-xtoq_context_t *
-_xtoq_get_context_node_by_window_id (xcb_window_t window_id)
+xcwm_context_t *
+_xcwm_get_context_node_by_window_id (xcb_window_t window_id)
{
- _xtoq_context_node *curr;
+ _xcwm_context_node *curr;
- curr = _xtoq_window_list_head;
+ curr = _xcwm_window_list_head;
while (curr) {
if (curr->context->window == window_id) {
return curr->context;
@@ -75,11 +75,11 @@ _xtoq_get_context_node_by_window_id (xcb_window_t window_id)
void
-_xtoq_remove_context_node(xcb_window_t window_id) {
+_xcwm_remove_context_node(xcb_window_t window_id) {
- _xtoq_context_node *curr;
+ _xcwm_context_node *curr;
- curr = _xtoq_window_list_head;
+ curr = _xcwm_window_list_head;
while (curr != NULL) {
if (curr->context->window == window_id) {
// this will be freed in the event_loop
@@ -90,7 +90,7 @@ _xtoq_remove_context_node(xcb_window_t window_id) {
curr->prev->next = curr->next;
}
else{
- _xtoq_window_list_head = curr->next;
+ _xcwm_window_list_head = curr->next;
}
free(curr);
diff --git a/src/libcompositewm/data.h b/src/libcompositewm/data.h
index f7ea0d4..fc1e911 100644
--- a/src/libcompositewm/data.h
+++ b/src/libcompositewm/data.h
@@ -28,8 +28,8 @@
#ifndef _DATA_H_
#define _DATA_H_
-struct xtoq_event_t {
- xtoq_context_t *context;
+struct xcwm_event_t {
+ xcwm_context_t *context;
int event_type;
};
diff --git a/src/libcompositewm/event_loop.c b/src/libcompositewm/event_loop.c
index 0a42a8d..472ef94 100644
--- a/src/libcompositewm/event_loop.c
+++ b/src/libcompositewm/event_loop.c
@@ -27,11 +27,11 @@
#include <pthread.h>
#include <xcwm/xcwm.h>
-#include "xtoq_internal.h"
+#include "xcwm_internal.h"
typedef struct _connection_data {
xcb_connection_t *conn;
- xtoq_event_cb_t callback;
+ xcwm_event_cb_t callback;
} _connection_data;
/* The thread that is running the event loop */
@@ -46,24 +46,24 @@ pthread_mutex_t _event_thread_lock;
void
*run_event_loop(void *thread_arg_struct);
-/* Functions included in xtoq.h */
+/* Functions included in xcwm.h */
int
-xtoq_get_event_thread_lock (void)
+xcwm_get_event_thread_lock (void)
{
return pthread_mutex_lock(&_event_thread_lock);
}
int
-xtoq_release_event_thread_lock(void)
+xcwm_release_event_thread_lock(void)
{
return pthread_mutex_unlock(&_event_thread_lock);
}
-/* Functions included in xtoq_internal.h */
+/* Functions included in xcwm_internal.h */
int
-_xtoq_start_event_loop (xcb_connection_t *conn,
- xtoq_event_cb_t event_callback)
+_xcwm_start_event_loop (xcb_connection_t *conn,
+ xcwm_event_cb_t event_callback)
{
_connection_data *conn_data;
int ret_val;
@@ -89,7 +89,7 @@ _xtoq_start_event_loop (xcb_connection_t *conn,
}
int
-_xtoq_stop_event_loop(void)
+_xcwm_stop_event_loop(void)
{
if (_event_thread) {
return pthread_cancel(_event_thread);
@@ -102,8 +102,8 @@ void *run_event_loop (void *thread_arg_struct)
_connection_data *conn_data;
xcb_connection_t *event_conn;
xcb_generic_event_t *evt;
- xtoq_event_t *return_evt;
- xtoq_event_cb_t callback_ptr;
+ xcwm_event_t *return_evt;
+ xcwm_event_cb_t callback_ptr;
conn_data = thread_arg_struct;
event_conn = conn_data->conn;
@@ -122,10 +122,10 @@ void *run_event_loop (void *thread_arg_struct)
int old_height;
int old_width;
- return_evt = malloc(sizeof(xtoq_event_t));
+ return_evt = malloc(sizeof(xcwm_event_t));
return_evt->event_type = XTOQ_DAMAGE;
return_evt->context =
- _xtoq_get_context_node_by_window_id(dmgevnt->drawable);
+ _xcwm_get_context_node_by_window_id(dmgevnt->drawable);
if (!return_evt->context) {
free(return_evt);
continue;
@@ -135,7 +135,7 @@ void *run_event_loop (void *thread_arg_struct)
* area already marked - this should be set back to 0 by 0
* when area is actually redrawn. This is likely to be
* done in another thread that handles window redraws */
- xtoq_get_event_thread_lock();
+ xcwm_get_event_thread_lock();
old_x = return_evt->context->damaged_x;
old_y = return_evt->context->damaged_y;
@@ -163,7 +163,7 @@ void *run_event_loop (void *thread_arg_struct)
return_evt->context->damaged_height = dmgevnt->area.height;
}
}
- xtoq_release_event_thread_lock();
+ xcwm_release_event_thread_lock();
if (((old_x > dmgevnt->area.x) || (old_y > dmgevnt->area.y))
|| ((old_width < dmgevnt->area.width)
@@ -205,7 +205,7 @@ void *run_event_loop (void *thread_arg_struct)
exevnt->window, exevnt->x, exevnt->y);
printf("with dimentions (%d, %d).\n", exevnt->width, exevnt->height);
- return_evt = malloc(sizeof(xtoq_event_t));
+ return_evt = malloc(sizeof(xcwm_event_t));
return_evt->event_type = XTOQ_EXPOSE;
callback_ptr(return_evt);
break;
@@ -219,14 +219,14 @@ void *run_event_loop (void *thread_arg_struct)
case XCB_DESTROY_NOTIFY: {
// Window destroyed in root window
xcb_destroy_notify_event_t *notify = (xcb_destroy_notify_event_t *)evt;
- xtoq_context_t *context = _xtoq_destroy_window(notify);
+ xcwm_context_t *context = _xcwm_destroy_window(notify);
if (!context) {
/* Not a window in the list, don't try and destroy */
break;
}
- return_evt = malloc(sizeof(xtoq_event_t));
+ return_evt = malloc(sizeof(xcwm_event_t));
return_evt->event_type = XTOQ_DESTROY;
return_evt->context = context;
@@ -236,13 +236,13 @@ void *run_event_loop (void *thread_arg_struct)
}
case XCB_MAP_REQUEST: {
xcb_map_request_event_t *request = (xcb_map_request_event_t *)evt;
- return_evt = malloc(sizeof(xtoq_event_t));
- return_evt->context = _xtoq_window_created(event_conn, request);
+ return_evt = malloc(sizeof(xcwm_event_t));
+ return_evt->context = _xcwm_window_created(event_conn, request);
if (!return_evt->context) {
free(return_evt);
break;
}
- _xtoq_map_window(return_evt->context);
+ _xcwm_map_window(return_evt->context);
return_evt->event_type = XTOQ_CREATE;
callback_ptr(return_evt);
break;
@@ -258,7 +258,7 @@ void *run_event_loop (void *thread_arg_struct)
request->width, request->height);
/* Change the size of the window, but not its position */
- _xtoq_resize_window(event_conn, request->window,
+ _xcwm_resize_window(event_conn, request->window,
request->width, request->height);
break;
}
@@ -302,11 +302,11 @@ void *run_event_loop (void *thread_arg_struct)
return NULL;
}
-int xtoq_event_get_type(xtoq_event_t const *event) {
+int xcwm_event_get_type(xcwm_event_t const *event) {
return event->event_type;
}
-xtoq_context_t * xtoq_event_get_context(xtoq_event_t const *event) {
+xcwm_context_t * xcwm_event_get_context(xcwm_event_t const *event) {
return event->context;
}
diff --git a/src/libcompositewm/init.c b/src/libcompositewm/init.c
index 4195bad..19c9c67 100644
--- a/src/libcompositewm/init.c
+++ b/src/libcompositewm/init.c
@@ -24,14 +24,14 @@
*/
#include <string.h>
-#include "xtoq_internal.h"
+#include "xcwm_internal.h"
int _damage_event = 0;
-xtoq_wm_atoms *_wm_atoms = NULL;
+xcwm_wm_atoms *_wm_atoms = NULL;
xcb_query_extension_reply_t *
-_xtoq_init_extension (xcb_connection_t *conn, char *extension_name)
+_xcwm_init_extension (xcb_connection_t *conn, char *extension_name)
{
xcb_query_extension_cookie_t cookie = xcb_query_extension(conn, strlen(extension_name), extension_name);
xcb_query_extension_reply_t *reply = xcb_query_extension_reply(conn, cookie, NULL);
@@ -47,10 +47,10 @@ _xtoq_init_extension (xcb_connection_t *conn, char *extension_name)
}
void
-_xtoq_init_damage(xtoq_context_t *contxt)
+_xcwm_init_damage(xcwm_context_t *contxt)
{
- xcb_query_extension_reply_t *reply =_xtoq_init_extension(contxt->conn, "DAMAGE");
+ xcb_query_extension_reply_t *reply =_xcwm_init_extension(contxt->conn, "DAMAGE");
xcb_damage_query_version_cookie_t version_cookie =
xcb_damage_query_version(contxt->conn,
@@ -77,8 +77,8 @@ _xtoq_init_damage(xtoq_context_t *contxt)
}
void
-_xtoq_init_composite(xtoq_context_t *contxt) {
- xcb_query_extension_reply_t *reply = _xtoq_init_extension(contxt->conn, "Composite");
+_xcwm_init_composite(xcwm_context_t *contxt) {
+ xcb_query_extension_reply_t *reply = _xcwm_init_extension(contxt->conn, "Composite");
xcb_composite_query_version_cookie_t cookie = xcb_composite_query_version (contxt->conn, XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION);
@@ -92,7 +92,7 @@ _xtoq_init_composite(xtoq_context_t *contxt) {
}
void
-_xtoq_init_xfixes (xtoq_context_t *contxt)
+_xcwm_init_xfixes (xcwm_context_t *contxt)
{
xcb_xfixes_query_version_cookie_t cookie =
xcb_xfixes_query_version(contxt->conn, 4, 0);
@@ -104,13 +104,13 @@ _xtoq_init_xfixes (xtoq_context_t *contxt)
}
void
-_xtoq_get_wm_atoms (xtoq_context_t *context)
+_xcwm_get_wm_atoms (xcwm_context_t *context)
{
xcb_intern_atom_reply_t *atom_reply;
xcb_intern_atom_cookie_t atom_cookie;
xcb_generic_error_t *error;
- _wm_atoms = malloc(sizeof(xtoq_wm_atoms));
+ _wm_atoms = malloc(sizeof(xcwm_wm_atoms));
/* WM_PROTOCOLS */
atom_cookie = xcb_intern_atom(context->conn,
diff --git a/src/libcompositewm/input.c b/src/libcompositewm/input.c
index cf70272..bebf317 100644
--- a/src/libcompositewm/input.c
+++ b/src/libcompositewm/input.c
@@ -21,15 +21,15 @@
//
// input.c
-// xtoq-xcode
+// xcwm-xcode
#include <stdio.h>
#include <xcwm/xcwm.h>
-#include "xtoq_internal.h"
+#include "xcwm_internal.h"
void
-xtoq_key_press (xtoq_context_t *context, int window, uint8_t code)
+xcwm_key_press (xcwm_context_t *context, int window, uint8_t code)
{
xcb_generic_error_t *err;
xcb_void_cookie_t cookie;
@@ -45,11 +45,11 @@ xtoq_key_press (xtoq_context_t *context, int window, uint8_t code)
free(err);
}
xcb_flush(context->conn);
- printf("xtoq.c received key down - uint8_t '%i', from Mac window #%i to context.window %u\n", code, window, context->window);
+ printf("xcwm.c received key down - uint8_t '%i', from Mac window #%i to context.window %u\n", code, window, context->window);
}
void
-xtoq_key_release (xtoq_context_t *context, int window, uint8_t code)
+xcwm_key_release (xcwm_context_t *context, int window, uint8_t code)
{
xcb_generic_error_t *err;
xcb_void_cookie_t cookie;
@@ -65,34 +65,34 @@ xtoq_key_release (xtoq_context_t *context, int window, uint8_t code)
free(err);
}
xcb_flush(context->conn);
- printf("xtoq.c received key release- uint8_t '%i', from Mac window #%i to context.window %u\n", code, window, context->window);
+ printf("xcwm.c received key release- uint8_t '%i', from Mac window #%i to context.window %u\n", code, window, context->window);
}
void
-xtoq_button_press (xtoq_context_t *context, long x, long y, int window, int button)
+xcwm_button_press (xcwm_context_t *context, long x, long y, int window, int button)
{
//xcb_window_t none = { XCB_NONE };
xcb_test_fake_input (context->conn, XCB_BUTTON_PRESS, 1, XCB_CURRENT_TIME,
context->window, 0, 0, 0);
xcb_flush(context->conn);
- printf("button down received by xtoq.c - (%ld,%ld) in Mac window #%i\n", x, y, window);
+ printf("button down received by xcwm.c - (%ld,%ld) in Mac window #%i\n", x, y, window);
}
void
-xtoq_button_release (xtoq_context_t *context, long x, long y, int window, int button)
+xcwm_button_release (xcwm_context_t *context, long x, long y, int window, int button)
{
xcb_test_fake_input (context->conn, XCB_BUTTON_RELEASE, 1, XCB_CURRENT_TIME,
context->window, 0, 0, 0);
xcb_flush(context->conn);
- printf("button release received by xtoq.c - (%ld,%ld) in Mac window #%i\n", x, y, window);
+ printf("button release received by xcwm.c - (%ld,%ld) in Mac window #%i\n", x, y, window);
}
void
-xtoq_mouse_motion (xtoq_context_t *context, long x, long y, int window, int button)
+xcwm_mouse_motion (xcwm_context_t *context, long x, long y, int window, int button)
{
xcb_test_fake_input (context->conn, XCB_MOTION_NOTIFY, 0, XCB_CURRENT_TIME,
root_context->window//root_context->window//none//context->parent
,x, y, 0);
xcb_flush(context->conn);
- //printf("mouse motion received by xtoq.c - (%ld,%ld) in Mac window #%i\n", x, y, window);
+ //printf("mouse motion received by xcwm.c - (%ld,%ld) in Mac window #%i\n", x, y, window);
}
diff --git a/src/libcompositewm/util.c b/src/libcompositewm/util.c
index 6b3c28a..887610b 100644
--- a/src/libcompositewm/util.c
+++ b/src/libcompositewm/util.c
@@ -23,12 +23,12 @@
* SOFTWARE.
*/
-#include "xtoq_internal.h"
+#include "xcwm_internal.h"
#include <xcb/xcb.h>
xcb_get_window_attributes_reply_t *
-_xtoq_get_window_attributes (xcb_connection_t *conn, xcb_window_t window)
+_xcwm_get_window_attributes (xcb_connection_t *conn, xcb_window_t window)
{
xcb_get_window_attributes_reply_t *reply;
xcb_generic_error_t *error;
@@ -45,7 +45,7 @@ _xtoq_get_window_attributes (xcb_connection_t *conn, xcb_window_t window)
}
xcb_get_geometry_reply_t *
-_xtoq_get_window_geometry (xcb_connection_t *conn, xcb_window_t window)
+_xcwm_get_window_geometry (xcb_connection_t *conn, xcb_window_t window)
{
xcb_get_geometry_cookie_t cookie;
cookie = xcb_get_geometry(conn, window);
@@ -54,7 +54,7 @@ _xtoq_get_window_geometry (xcb_connection_t *conn, xcb_window_t window)
void
-_xtoq_write_all_children_window_info (xcb_connection_t *conn,
+_xcwm_write_all_children_window_info (xcb_connection_t *conn,
xcb_window_t root)
{
@@ -81,8 +81,8 @@ _xtoq_write_all_children_window_info (xcb_connection_t *conn,
printf("--- Iterating through children of window %u ---\n",
root);
for (i = 0; i < len; i++) {
- _xtoq_write_window_info(conn, children[i]);
- img_data = _xtoq_get_window_image_data(conn, children[i]);
+ _xcwm_write_window_info(conn, children[i]);
+ img_data = _xcwm_get_window_image_data(conn, children[i]);
if (!img_data.data) {
printf("Image data is empty\n");
}
@@ -94,7 +94,7 @@ _xtoq_write_all_children_window_info (xcb_connection_t *conn,
}
image_data_t
-_xtoq_get_window_image_data (xcb_connection_t *conn, xcb_drawable_t window)
+_xcwm_get_window_image_data (xcb_connection_t *conn, xcb_drawable_t window)
{
image_data_t image_data;
xcb_get_image_cookie_t img_cookie;
@@ -105,7 +105,7 @@ _xtoq_get_window_image_data (xcb_connection_t *conn, xcb_drawable_t window)
image_data.data = NULL;
image_data.length = 0;
- geom_reply = _xtoq_get_window_geometry(conn, window);
+ geom_reply = _xcwm_get_window_geometry(conn, window);
if (!geom_reply) {
fprintf(stderr, "ERROR: Failed to get window image data.\n");
return image_data;
@@ -136,17 +136,17 @@ _xtoq_get_window_image_data (xcb_connection_t *conn, xcb_drawable_t window)
}
void
-_xtoq_write_window_info (xcb_connection_t *conn, xcb_window_t window)
+_xcwm_write_window_info (xcb_connection_t *conn, xcb_window_t window)
{
xcb_get_geometry_reply_t *geom_reply;
xcb_get_window_attributes_reply_t *attr_reply;
- geom_reply = _xtoq_get_window_geometry(conn, window);
+ geom_reply = _xcwm_get_window_geometry(conn, window);
if (!geom_reply) {
printf("Failed to get geometry for window %u\n", window);
return;
}
- attr_reply = _xtoq_get_window_attributes(conn, window);
+ attr_reply = _xcwm_get_window_attributes(conn, window);
if (!attr_reply) {
printf("Failed to get attributes for window %u\n", window);
return;
@@ -171,7 +171,7 @@ _xtoq_write_window_info (xcb_connection_t *conn, xcb_window_t window)
}
int
-_xtoq_request_check (xcb_connection_t *conn, xcb_void_cookie_t cookie,
+_xcwm_request_check (xcb_connection_t *conn, xcb_void_cookie_t cookie,
char *msg)
{
xcb_generic_error_t *error;
diff --git a/src/libcompositewm/window.c b/src/libcompositewm/window.c
index ec4f7c4..7a463f0 100644
--- a/src/libcompositewm/window.c
+++ b/src/libcompositewm/window.c
@@ -24,30 +24,30 @@
*/
#include <xcwm/xcwm.h>
-#include "xtoq_internal.h"
+#include "xcwm_internal.h"
/* Functions only used within this file */
/* Sets the WM_* properties we care about in context */
void
-set_icccm_properties (xtoq_context_t *context);
+set_icccm_properties (xcwm_context_t *context);
/* Set the WM_NAME property in context */
void
-set_wm_name_in_context (xtoq_context_t *context);
+set_wm_name_in_context (xcwm_context_t *context);
/* Find out of the WM_DELETE_WINDOW property is set */
void
-set_wm_delete_win_in_context (xtoq_context_t *context);
+set_wm_delete_win_in_context (xcwm_context_t *context);
/* Initialize damage on a window */
void
-init_damage_on_window (xtoq_context_t *context);
+init_damage_on_window (xcwm_context_t *context);
/* Set window to the top of the stack */
void
-xtoq_set_window_to_top(xtoq_context_t *context) {
+xcwm_set_window_to_top(xcwm_context_t *context) {
const static uint32_t values[] = { XCB_STACK_MODE_ABOVE };
@@ -57,7 +57,7 @@ xtoq_set_window_to_top(xtoq_context_t *context) {
/* Set window to the bottom of the stack */
void
-xtoq_set_window_to_bottom(xtoq_context_t *context) {
+xcwm_set_window_to_bottom(xcwm_context_t *context) {
const static uint32_t values[] = { XCB_STACK_MODE_BELOW };
@@ -67,7 +67,7 @@ xtoq_set_window_to_bottom(xtoq_context_t *context) {
/* Set input focus to window */
void
-xtoq_set_input_focus(xtoq_context_t *context) {
+xcwm_set_input_focus(xcwm_context_t *context) {
// Test -- David
xcb_get_input_focus_cookie_t cookie = xcb_get_input_focus(context->conn);
@@ -81,19 +81,19 @@ xtoq_set_input_focus(xtoq_context_t *context) {
xcb_flush(context->conn);
}
-xtoq_context_t *
-_xtoq_window_created(xcb_connection_t * conn, xcb_map_request_event_t *event) {
+xcwm_context_t *
+_xcwm_window_created(xcb_connection_t * conn, xcb_map_request_event_t *event) {
/* Check to see if the window is already created */
- if (_xtoq_get_context_node_by_window_id(event->window)) {
+ if (_xcwm_get_context_node_by_window_id(event->window)) {
return NULL;
}
- /* allocate memory for new xtoq_context_t */
- xtoq_context_t *context = malloc(sizeof(xtoq_context_t));
+ /* allocate memory for new xcwm_context_t */
+ xcwm_context_t *context = malloc(sizeof(xcwm_context_t));
xcb_get_geometry_reply_t *geom;
- geom = _xtoq_get_window_geometry(conn, event->window);
+ geom = _xcwm_get_window_geometry(conn, event->window);
/* set any available values from xcb_create_notify_event_t object pointer
and geom pointer */
@@ -114,15 +114,15 @@ _xtoq_window_created(xcb_connection_t * conn, xcb_map_request_event_t *event) {
init_damage_on_window(context);
/* add context to context_list */
- context = _xtoq_add_context_t(context);
+ context = _xcwm_add_context_t(context);
return context;
}
-xtoq_context_t *
-_xtoq_destroy_window(xcb_destroy_notify_event_t *event) {
+xcwm_context_t *
+_xcwm_destroy_window(xcb_destroy_notify_event_t *event) {
- xtoq_context_t *context = _xtoq_get_context_node_by_window_id(event->window);
+ xcwm_context_t *context = _xcwm_get_context_node_by_window_id(event->window);
if (!context) {
/* Window isn't being managed */
return NULL;
@@ -132,15 +132,15 @@ _xtoq_destroy_window(xcb_destroy_notify_event_t *event) {
xcb_damage_destroy(context->conn,context->damage);
/* Call the remove function in context_list.c */
- _xtoq_remove_context_node(context->window);
+ _xcwm_remove_context_node(context->window);
/* Return the pointer for the context that was removed from the list. */
return context;
}
void
-xtoq_configure_window(xtoq_context_t *context, int x, int y, int height, int width) {
+xcwm_configure_window(xcwm_context_t *context, int x, int y, int height, int width) {
- /* Set values for xtoq_context_t */
+ /* Set values for xcwm_context_t */
context->x = x;
context->y = y;
context->width = width;
@@ -160,10 +160,10 @@ xtoq_configure_window(xtoq_context_t *context, int x, int y, int height, int wid
}
void
-xtoq_request_close(xtoq_context_t *context) {
+xcwm_request_close(xcwm_context_t *context) {
/* check to see if the context is in the list */
- context = _xtoq_get_context_node_by_window_id(context->window);
+ context = _xcwm_get_context_node_by_window_id(context->window);
if (!context)
return;
@@ -197,7 +197,7 @@ xtoq_request_close(xtoq_context_t *context) {
/* Resize the window on server side */
void
-_xtoq_resize_window (xcb_connection_t *conn, xcb_window_t window,
+_xcwm_resize_window (xcb_connection_t *conn, xcb_window_t window,
int width, int height)
{
uint32_t values[2] = { width, height };
@@ -211,7 +211,7 @@ _xtoq_resize_window (xcb_connection_t *conn, xcb_window_t window,
}
void
-_xtoq_map_window (xtoq_context_t *context)
+_xcwm_map_window (xcwm_context_t *context)
{
/* Map the window. May want to handle other things here */
xcb_map_window(context->conn, context->window);
@@ -219,14 +219,14 @@ _xtoq_map_window (xtoq_context_t *context)
}
void
-set_icccm_properties (xtoq_context_t *context)
+set_icccm_properties (xcwm_context_t *context)
{
set_wm_name_in_context(context);
set_wm_delete_win_in_context(context);
}
void
-set_wm_name_in_context (xtoq_context_t *context)
+set_wm_name_in_context (xcwm_context_t *context)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@@ -257,7 +257,7 @@ set_wm_name_in_context (xtoq_context_t *context)
}
void
-set_wm_delete_win_in_context (xtoq_context_t *context)
+set_wm_delete_win_in_context (xcwm_context_t *context)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
@@ -300,7 +300,7 @@ set_wm_delete_win_in_context (xtoq_context_t *context)
}
void
-init_damage_on_window (xtoq_context_t *context)
+init_damage_on_window (xcwm_context_t *context)
{
xcb_damage_damage_t damage_id;
uint8_t level;
@@ -316,7 +316,7 @@ init_damage_on_window (xtoq_context_t *context)
context->window,
level);
- if (_xtoq_request_check(context->conn, cookie,
+ if (_xcwm_request_check(context->conn, cookie,
"Could not create damage for window")) {
context->damage = 0;
return;
diff --git a/src/libcompositewm/xtoq.c b/src/libcompositewm/xcwm.c
index ebeca75..974222b 100644
--- a/src/libcompositewm/xtoq.c
+++ b/src/libcompositewm/xcwm.c
@@ -27,7 +27,7 @@
/* #define _XTOQ_C_ */
#include <xcwm/xcwm.h>
-#include "xtoq_internal.h"
+#include "xcwm_internal.h"
#include "X11/keysym.h"
#include <string.h>
@@ -35,12 +35,12 @@
#define XK_Shift_L 0xffe1
xcb_key_symbols_t *syms = NULL;
// end aaron key stuff
-xtoq_context_t *root_context = NULL;
+xcwm_context_t *root_context = NULL;
// This init function needs set the window to be registered for events!
// First one we should handle is damage
-xtoq_context_t *
-xtoq_init(char *display) {
+xcwm_context_t *
+xcwm_init(char *display) {
xcb_connection_t *conn;
int conn_screen;
@@ -70,7 +70,7 @@ xtoq_init(char *display) {
cookie = xcb_change_window_attributes_checked(conn, root_window,
XCB_CW_EVENT_MASK,
mask_values);
- if (_xtoq_request_check(conn, cookie, "Could not set root window mask.")) {
+ if (_xcwm_request_check(conn, cookie, "Could not set root window mask.")) {
fprintf(stderr, "Is another window manager running?\n");
xcb_disconnect(conn);
exit(1);
@@ -78,45 +78,45 @@ xtoq_init(char *display) {
xcb_flush(conn);
- root_context = malloc(sizeof(xtoq_context_t));
+ root_context = malloc(sizeof(xcwm_context_t));
root_context->conn = conn;
root_context->parent = 0;
root_context->window = root_window;
- // Set width, height, x, & y from root_screen into the xtoq_context_t
+ // Set width, height, x, & y from root_screen into the xcwm_context_t
root_context->width = root_screen->width_in_pixels;
root_context->height = root_screen->height_in_pixels;
root_context->x = 0;
root_context->y = 0;
- _xtoq_init_composite(root_context);
+ _xcwm_init_composite(root_context);
- _xtoq_init_damage(root_context);
+ _xcwm_init_damage(root_context);
- _xtoq_init_xfixes(root_context);
+ _xcwm_init_xfixes(root_context);
- _xtoq_add_context_t(root_context);
+ _xcwm_add_context_t(root_context);
syms = xcb_key_symbols_alloc(conn);
- _xtoq_init_extension(conn, "XTEST");
- _xtoq_init_extension(conn, "XKEYBOARD");
+ _xcwm_init_extension(conn, "XTEST");
+ _xcwm_init_extension(conn, "XKEYBOARD");
- _xtoq_get_wm_atoms(root_context);
+ _xcwm_get_wm_atoms(root_context);
return root_context;
}
-xtoq_image_t *
-xtoq_get_image(xtoq_context_t *context) {
+xcwm_image_t *
+xcwm_get_image(xcwm_context_t *context) {
xcb_get_geometry_reply_t *geom_reply;
xcb_image_t *image;
- geom_reply = _xtoq_get_window_geometry(context->conn, context->window);
+ geom_reply = _xcwm_get_window_geometry(context->conn, context->window);
//FIXME - right size
- xtoq_image_t * xtoq_image = (xtoq_image_t *) malloc(10 * sizeof (xtoq_image_t));
+ xcwm_image_t * xcwm_image = (xcwm_image_t *) malloc(10 * sizeof (xcwm_image_t));
xcb_flush(context->conn);
/* Get the image of the root window */
@@ -129,27 +129,27 @@ xtoq_get_image(xtoq_context_t *context) {
(unsigned int) ~0L,
XCB_IMAGE_FORMAT_Z_PIXMAP);
- xtoq_image->image = image;
- xtoq_image->x = geom_reply->x;
- xtoq_image->y = geom_reply->y;
- xtoq_image->width = geom_reply->width;
- xtoq_image->height = geom_reply->height;
+ xcwm_image->image = image;
+ xcwm_image->x = geom_reply->x;
+ xcwm_image->y = geom_reply->y;
+ xcwm_image->width = geom_reply->width;
+ xcwm_image->height = geom_reply->height;
free(geom_reply);
- return xtoq_image;
+ return xcwm_image;
}
int
-xtoq_start_event_loop (xtoq_context_t *context,
- xtoq_event_cb_t callback)
+xcwm_start_event_loop (xcwm_context_t *context,
+ xcwm_event_cb_t callback)
{
/* Simply call our internal function to do the actual setup */
- return _xtoq_start_event_loop(context->conn, callback);
+ return _xcwm_start_event_loop(context->conn, callback);
}
-xtoq_image_t *
-test_xtoq_get_image(xtoq_context_t *context) {
+xcwm_image_t *
+test_xcwm_get_image(xcwm_context_t *context) {
xcb_image_t *image;
@@ -165,28 +165,28 @@ test_xtoq_get_image(xtoq_context_t *context) {
XCB_IMAGE_FORMAT_Z_PIXMAP);
//FIXME - Calculate memory size correctly
- xtoq_image_t * xtoq_image = (xtoq_image_t *) malloc(10 * sizeof (xtoq_image_t));
+ xcwm_image_t * xcwm_image = (xcwm_image_t *) malloc(10 * sizeof (xcwm_image_t));
- xtoq_image->image = image;
- xtoq_image->x = context->damaged_x;
- xtoq_image->y = context->damaged_y;
- xtoq_image->width = context->damaged_width;
- xtoq_image->height = context->damaged_height;
+ xcwm_image->image = image;
+ xcwm_image->x = context->damaged_x;
+ xcwm_image->y = context->damaged_y;
+ xcwm_image->width = context->damaged_width;
+ xcwm_image->height = context->damaged_height;
- return xtoq_image;
+ return xcwm_image;
}
void
-xtoq_image_destroy(xtoq_image_t * xtoq_image){
+xcwm_image_destroy(xcwm_image_t * xcwm_image){
- xcb_image_destroy(xtoq_image->image);
- free(xtoq_image);
+ xcb_image_destroy(xcwm_image->image);
+ free(xcwm_image);
}
void
-xtoq_remove_context_damage(xtoq_context_t *context)
+xcwm_remove_context_damage(xcwm_context_t *context)
{
xcb_xfixes_region_t region = xcb_generate_id(context->conn);
xcb_rectangle_t rect;
@@ -211,7 +211,7 @@ xtoq_remove_context_damage(xtoq_context_t *context)
region,
0);
- if (!(_xtoq_request_check(context->conn, cookie,
+ if (!(_xcwm_request_check(context->conn, cookie,
"Failed to subtract damage"))) {
context->damaged_x = 0;
context->damaged_y = 0;
@@ -222,25 +222,25 @@ xtoq_remove_context_damage(xtoq_context_t *context)
}
/* Close all windows, the connection, as well as the event loop */
-void xtoq_close(void) {
+void xcwm_close(void) {
- _xtoq_context_node *head = _xtoq_window_list_head;
+ _xcwm_context_node *head = _xcwm_window_list_head;
xcb_connection_t *conn = head->context->conn;
xcb_flush(conn);
// Close all windows
while(head) {
- xtoq_request_close(head->context);
- _xtoq_window_list_head = head->next;
+ xcwm_request_close(head->context);
+ _xcwm_window_list_head = head->next;
free(head);
- head = _xtoq_window_list_head;
+ head = _xcwm_window_list_head;
}
// Disconnect from the display
xcb_disconnect(conn);
// Terminate the event loop
- int ret = _xtoq_stop_event_loop();
+ int ret = _xcwm_stop_event_loop();
if (ret != 1) printf("Event loop failed to close\n");
return;
diff --git a/src/libcompositewm/xtoq_internal.h b/src/libcompositewm/xcwm_internal.h
index 891aee9..94081c7 100644
--- a/src/libcompositewm/xtoq_internal.h
+++ b/src/libcompositewm/xcwm_internal.h
@@ -1,7 +1,7 @@
/* Copyright (c) 2012 Jess VanDerwalker <washu@sonic.net>
* All rights reserved.
*
- * xtoq_internal.h
+ * xcwm_internal.h
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -41,25 +41,25 @@
#include "data.h"
/**
- * Strucuture used to pass nesessary data to xtoq_start_event_loop.
+ * Strucuture used to pass nesessary data to xcwm_start_event_loop.
*/
-typedef struct xtoq_event_connetion {
+typedef struct xcwm_event_connetion {
xcb_connection_t *conn; /* Connection to listen to events on */
- xtoq_event_cb_t event_callback; /* Fuction to call when event caught */
-} xtoq_event_connection;
+ xcwm_event_cb_t event_callback; /* Fuction to call when event caught */
+} xcwm_event_connection;
/**
* Structure to hold WM_* atoms that we care about
*/
-typedef struct xtoq_wm_atoms {
+typedef struct xcwm_wm_atoms {
xcb_atom_t wm_protocols_atom;
xcb_atom_t wm_delete_window_atom;
-} xtoq_wm_atoms;
+} xcwm_wm_atoms;
/**
* Global for the atoms needed
*/
-extern xtoq_wm_atoms *_wm_atoms;
+extern xcwm_wm_atoms *_wm_atoms;
/**
* Mutex lock supplied to client to lock event loop thread
@@ -76,7 +76,7 @@ extern pthread_mutex_t event_thread_lock;
* @return The window attributes reply. Null if the request fails.
*/
xcb_get_window_attributes_reply_t *
-_xtoq_get_window_attributes (xcb_connection_t *conn, xcb_window_t window);
+_xcwm_get_window_attributes (xcb_connection_t *conn, xcb_window_t window);
/**
* Return the geometry of the window in a geometry reply. Caller must free
@@ -86,7 +86,7 @@ _xtoq_get_window_attributes (xcb_connection_t *conn, xcb_window_t window);
* @return The window's geometry reply. Null if the request for reply fails.
*/
xcb_get_geometry_reply_t *
-_xtoq_get_window_geometry (xcb_connection_t *conn, xcb_window_t window);
+_xcwm_get_window_geometry (xcb_connection_t *conn, xcb_window_t window);
/**
* Print out information about the existing windows attached to our
@@ -97,7 +97,7 @@ _xtoq_get_window_geometry (xcb_connection_t *conn, xcb_window_t window);
* @return the geometry of the window
*/
void
-_xtoq_write_all_children_window_info (xcb_connection_t *conn,
+_xcwm_write_all_children_window_info (xcb_connection_t *conn,
xcb_window_t root);
/**
@@ -107,7 +107,7 @@ _xtoq_write_all_children_window_info (xcb_connection_t *conn,
* @return a structure containing data and data length.
*/
image_data_t
-_xtoq_get_window_image_data (xcb_connection_t *conn, xcb_window_t window);
+_xcwm_get_window_image_data (xcb_connection_t *conn, xcb_window_t window);
/**
* Write information about a window out to stdio.
@@ -116,7 +116,7 @@ _xtoq_get_window_image_data (xcb_connection_t *conn, xcb_window_t window);
* @param window The window.
*/
void
-_xtoq_write_window_info (xcb_connection_t *conn, xcb_window_t window);
+_xcwm_write_window_info (xcb_connection_t *conn, xcb_window_t window);
/**
* Check the request cookie and determine if there is an error.
@@ -126,7 +126,7 @@ _xtoq_write_window_info (xcb_connection_t *conn, xcb_window_t window);
* @return int The number of the error code, if any. Otherwise zero.
*/
int
-_xtoq_request_check (xcb_connection_t *conn, xcb_void_cookie_t cookie,
+_xcwm_request_check (xcb_connection_t *conn, xcb_void_cookie_t cookie,
char *msg);
/****************
@@ -140,7 +140,7 @@ _xtoq_request_check (xcb_connection_t *conn, xcb_void_cookie_t cookie,
* @return The reply structure
*/
xcb_query_extension_reply_t *
-_xtoq_init_extension(xcb_connection_t *conn, char *extension_name);
+_xcwm_init_extension(xcb_connection_t *conn, char *extension_name);
/**
* Initializes damage on a window contained in a context.
@@ -148,7 +148,7 @@ _xtoq_init_extension(xcb_connection_t *conn, char *extension_name);
* @param contxt A context containing a window
*/
void
-_xtoq_init_damage(xtoq_context_t *contxt);
+_xcwm_init_damage(xcwm_context_t *contxt);
/**
* Initializes the composite extension on the context containg
@@ -156,21 +156,21 @@ _xtoq_init_damage(xtoq_context_t *contxt);
* @param contxt The contxt containing the root window
*/
void
-_xtoq_init_composite(xtoq_context_t *contxt);
+_xcwm_init_composite(xcwm_context_t *contxt);
/**
* Initialize the xfixes extension.
* @param contxt The context
*/
void
-_xtoq_init_xfixes (xtoq_context_t *contxt);
+_xcwm_init_xfixes (xcwm_context_t *contxt);
/**
* Get the values for the WM_* atoms that we need.
* @param contxt The context
*/
void
-_xtoq_get_wm_atoms (xtoq_context_t *contxt);
+_xcwm_get_wm_atoms (xcwm_context_t *contxt);
/****************
* event_loop.c
@@ -184,15 +184,15 @@ _xtoq_get_wm_atoms (xtoq_context_t *contxt);
* @return 0 on success, nonzero on failure.
*/
int
-_xtoq_start_event_loop (xcb_connection_t *conn,
- xtoq_event_cb_t event_callback);
+_xcwm_start_event_loop (xcb_connection_t *conn,
+ xcwm_event_cb_t event_callback);
/**
* Stops the thread running the event loop.
* @return 0 on success, otherwise zero.
*/
int
-_xtoq_stop_event_loop (void);
+_xcwm_stop_event_loop (void);
/****************
* context_list.c
@@ -202,22 +202,22 @@ _xtoq_stop_event_loop (void);
* A structure (doubly linked list) to hold
* pointers to the contexts
*/
-typedef struct _xtoq_context_node {
- struct xtoq_context_t *context; /**< Pointer to a context */
- struct _xtoq_context_node * next; /**< Pointer to the next context node */
- struct _xtoq_context_node * prev; /**< Pointer to the previous context node */
-} _xtoq_context_node;
+typedef struct _xcwm_context_node {
+ struct xcwm_context_t *context; /**< Pointer to a context */
+ struct _xcwm_context_node * next; /**< Pointer to the next context node */
+ struct _xcwm_context_node * prev; /**< Pointer to the previous context node */
+} _xcwm_context_node;
/* this is the head pointer */
-extern _xtoq_context_node *_xtoq_window_list_head;
+extern _xcwm_context_node *_xcwm_window_list_head;
/**
* Add a newly created context to the context_list.
* @param context The context to be added to the linked list
* @return Pointer to context added to the list.
*/
-xtoq_context_t *
-_xtoq_add_context_t(struct xtoq_context_t *context);
+xcwm_context_t *
+_xcwm_add_context_t(struct xcwm_context_t *context);
/**
* Remove a context to the context_list using the window's id.
@@ -225,15 +225,15 @@ _xtoq_add_context_t(struct xtoq_context_t *context);
* be removed from the context_list
*/
void
-_xtoq_remove_context_node(xcb_window_t window_id);
+_xcwm_remove_context_node(xcb_window_t window_id);
/**
* Find a context in the doubly linked list using its window_id.
* @param window_id The window_id of the context which should
* @return Pointer to context (if found), NULL if not found.
*/
-xtoq_context_t *
-_xtoq_get_context_node_by_window_id (xcb_window_t window_id);
+xcwm_context_t *
+_xcwm_get_context_node_by_window_id (xcb_window_t window_id);
/****************
* window.c
@@ -245,8 +245,8 @@ _xtoq_get_context_node_by_window_id (xcb_window_t window_id);
* @param evt The map event for the window
* @return Pointer to new context. NULL if window already exists.
*/
-xtoq_context_t *
-_xtoq_window_created(xcb_connection_t * conn,
+xcwm_context_t *
+_xcwm_window_created(xcb_connection_t * conn,
xcb_map_request_event_t *evt);
/**
* Destroy the damage object associated with the window.
@@ -256,8 +256,8 @@ _xtoq_window_created(xcb_connection_t * conn,
* @return Pointer to the context that was removed from the list, NULL if
* window isn't being managed by context_list
*/
-xtoq_context_t *
-_xtoq_destroy_window(xcb_destroy_notify_event_t *event);
+xcwm_context_t *
+_xcwm_destroy_window(xcb_destroy_notify_event_t *event);
/**
* Resize the window to given width and height.
@@ -267,7 +267,7 @@ _xtoq_destroy_window(xcb_destroy_notify_event_t *event);
* @param height The new height
*/
void
-_xtoq_resize_window (xcb_connection_t *conn, xcb_window_t window,
+_xcwm_resize_window (xcb_connection_t *conn, xcb_window_t window,
int width, int height);
/**
@@ -275,6 +275,6 @@ _xtoq_resize_window (xcb_connection_t *conn, xcb_window_t window,
* @param context The context of the window to map
*/
void
-_xtoq_map_window (xtoq_context_t *context);
+_xcwm_map_window (xcwm_context_t *context);
#endif /* _XTOQ_INTERNAL_H_ */
diff --git a/src/xtoq/XtoqApplication.m b/src/xtoq/XtoqApplication.m
index f742e79..a2be93b 100644
--- a/src/xtoq/XtoqApplication.m
+++ b/src/xtoq/XtoqApplication.m
@@ -30,7 +30,7 @@ int XtoqApplicationMain(int argc, char** argv){
XtoqController *controller;
char *scrn;
FILE *fp;
- const char *fifo_path = "/tmp/xtoq_fifo";
+ const char *fifo_path = "/tmp/xcwm_fifo";
ssize_t bytes_read;
size_t len = 0;
char bundle_path[PATH_MAX];
diff --git a/src/xtoq/XtoqController.h b/src/xtoq/XtoqController.h
index 2475824..5b3d3aa 100644
--- a/src/xtoq/XtoqController.h
+++ b/src/xtoq/XtoqController.h
@@ -22,7 +22,7 @@
/**
* AppController.h
- * xtoq
+ * xcwm
*
* TODO: rename this class to XtoqController
* This was controller for the Popup to retreive the display number
@@ -53,16 +53,16 @@
id referenceToSelf;
@interface XtoqController : NSObject {
- XtoqWindow *xtoqWindow;
+ XtoqWindow *xcwmWindow;
XtoqView * ourView;
- dispatch_queue_t xtoqDispatchQueue;
+ dispatch_queue_t xcwmDispatchQueue;
//The X :1 paramater, updated in the XtoqApplication
char *screen;
- xtoq_image_t *libImageT;
- xtoq_context_t *rootContext;
+ xcwm_image_t *libImageT;
+ xcwm_context_t *rootContext;
xcb_image_t *imageT;
XtoqImageRep *image;
XtoqImageRep *imageNew;
@@ -158,12 +158,12 @@ id referenceToSelf;
* Put a new image in the window / view
* Send an image to the view after being notified of a damage event from
* the event handler.
- * @param an xtoq_context_t sent from eventHandler
+ * @param an xcwm_context_t sent from eventHandler
*/
-- (void) updateImage: (xtoq_context_t *) windowContext;
+- (void) updateImage: (xcwm_context_t *) windowContext;
-- (void) createNewWindow: (xtoq_context_t *) windowContext;
-- (void) destroyWindow: (xtoq_context_t *) windowContext;
+- (void) createNewWindow: (xcwm_context_t *) windowContext;
+- (void) destroyWindow: (xcwm_context_t *) windowContext;
/**
* Sets the variable screen to correct display.
@@ -189,8 +189,8 @@ id referenceToSelf;
/**
- * Callback function that will receive events from the xtoq event loop
+ * Callback function that will receive events from the xcwm event loop
* once it is started.
* @param event The event received.
*/
-void eventHandler (xtoq_event_t *event);
+void eventHandler (xcwm_event_t *event);
diff --git a/src/xtoq/XtoqController.m b/src/xtoq/XtoqController.m
index 42bda81..77430dc 100644
--- a/src/xtoq/XtoqController.m
+++ b/src/xtoq/XtoqController.m
@@ -22,7 +22,7 @@
/**
* AppController.m
- * xtoq
+ * xcwm
*
*
* This is the controller for the Popup to retreive the display number
@@ -61,12 +61,12 @@
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
// setup X connection and get the initial image from the server
- rootContext = xtoq_init(screen);
+ rootContext = xcwm_init(screen);
[[NSGraphicsContext currentContext]
setImageInterpolation:NSImageInterpolationHigh];
- xtoqWindow = [[XtoqWindow alloc]
+ xcwmWindow = [[XtoqWindow alloc]
initWithContentRect: NSMakeRect(rootContext->x, rootContext->y,
rootContext->width, rootContext->height)
styleMask: (NSTitledWindowMask |
@@ -76,13 +76,13 @@
backing: NSBackingStoreBuffered
defer: YES];
- [xtoqWindow setContext: rootContext];
- rootContext->local_data = xtoqWindow;
+ [xcwmWindow setContext: rootContext];
+ rootContext->local_data = xcwmWindow;
// Make the menu
[self makeMenu];
//create an XtoqImageRep with the information from X
- //libImageT = xtoq_get_image(rootContext);
+ //libImageT = xcwm_get_image(rootContext);
//image = [[XtoqImageRep alloc] initWithData:libImageT x:0 y:0];
//draw the image into a rect
imageRec = NSMakeRect(0, 0, 1028,768);//[image getWidth], [image getHeight]);
@@ -91,7 +91,7 @@
[ourView setContext: rootContext];
// add view to its window
- [xtoqWindow setContentView: ourView];
+ [xcwmWindow setContentView: ourView];
// set the initial image in the window
//[ourView setImage:image];
@@ -151,13 +151,13 @@
- xtoqDispatchQueue = dispatch_queue_create("xtoq.dispatch.queue", NULL);
+ xcwmDispatchQueue = dispatch_queue_create("xcwm.dispatch.queue", NULL);
}
- (void)applicationWillTerminate:(NSNotification *)aNotification
{
- xtoq_close();
+ xcwm_close();
const char *spawn[4];
pid_t child;
@@ -173,13 +173,13 @@
- (void) applicationDidFinishLaunching: (NSNotification *) aNotification
{
- [xtoqWindow makeKeyAndOrderFront: self];
+ [xcwmWindow makeKeyAndOrderFront: self];
//hide window
- [xtoqWindow orderOut:self];
+ [xcwmWindow orderOut:self];
// Start the event loop and set the handler function
- xtoq_start_event_loop(rootContext, (void *) eventHandler);
+ xcwm_start_event_loop(rootContext, (void *) eventHandler);
}
- (void) mouseMovedInApp: (NSNotification *) aNotification {
@@ -199,8 +199,8 @@
NSLog(@"Mouse x = %i, y = %i", [xVal intValue], [yVal intValue]);
- dispatch_async(xtoqDispatchQueue,
- ^{ xtoq_mouse_motion (rootContext,
+ dispatch_async(xcwmDispatchQueue,
+ ^{ xcwm_mouse_motion (rootContext,
[xVal intValue],
[yVal intValue],
(int)[event windowNumber],
@@ -219,18 +219,18 @@
const char* charcharstar = [charNSString UTF8String];
NSLog(@"%s pressed", charcharstar);
- dispatch_async(xtoqDispatchQueue,
- ^{ xtoq_key_press(rootContext,
+ dispatch_async(xcwmDispatchQueue,
+ ^{ xcwm_key_press(rootContext,
(int)[event windowNumber],
aChar + 8) ;});
- dispatch_async(xtoqDispatchQueue,
- ^{ xtoq_key_release(rootContext,
+ dispatch_async(xcwmDispatchQueue,
+ ^{ xcwm_key_release(rootContext,
(int)[event windowNumber],
aChar + 8) ;});
}
-// on this side all I have is a xtoq_context , on the library side I need
+// on this side all I have is a xcwm_context , on the library side I need
// to turn that into a real context
- (void) mouseButtonDownInView: (NSNotification *) aNotification
{
@@ -246,15 +246,15 @@
float height = [[NSScreen mainScreen] frame].size.height;
- dispatch_async(xtoqDispatchQueue,
- ^{ xtoq_button_press (rootContext,
+ dispatch_async(xcwmDispatchQueue,
+ ^{ xcwm_button_press (rootContext,
0,
0,
(int)[event windowNumber],
0);;});
}
-// on this side all I have is a xtoq_context , on the library side I need
+// on this side all I have is a xcwm_context , on the library side I need
// to turn that into a real context
- (void) mouseButtonReleaseInView: (NSNotification *) aNotification
{
@@ -270,8 +270,8 @@
float height = [[NSScreen mainScreen] frame].size.height;
- dispatch_async(xtoqDispatchQueue,
- ^{ xtoq_button_release (rootContext,
+ dispatch_async(xcwmDispatchQueue,
+ ^{ xcwm_button_release (rootContext,
0,
0,
(int)[event windowNumber],
@@ -395,11 +395,11 @@
}
// create a new window
-- (void) createNewWindow: (xtoq_context_t *) windowContext {
+- (void) createNewWindow: (xcwm_context_t *) windowContext {
XtoqWindow *newWindow;
XtoqView *newView;
- xtoq_image_t *xcbImage;
+ xcwm_image_t *xcbImage;
XtoqImageRep *imageRep;
int y = [self xserverToOSX:windowContext->y windowHeight:windowContext->height];
@@ -421,7 +421,7 @@
windowContext->local_data = (id)newWindow;
// get image to darw
- xcbImage = xtoq_get_image(windowContext);
+ xcbImage = xcwm_get_image(windowContext);
imageRep = [[XtoqImageRep alloc] initWithData:xcbImage x: 0 y: 0];
// draw the image into a rect
@@ -444,7 +444,7 @@
}
-- (void) destroyWindow:(xtoq_context_t *) windowContext {
+- (void) destroyWindow:(xcwm_context_t *) windowContext {
// set the window to be closed
XtoqWindow *destWindow = windowContext->local_data;
//close window
@@ -455,19 +455,19 @@
NSDictionary *contextInfo = [aNotification userInfo];
XtoqWindow *aWindow = [contextInfo objectForKey: @"1"];
- xtoq_context_t *theContext = [aWindow getContext];
+ xcwm_context_t *theContext = [aWindow getContext];
//use dispatch_async() to handle the actual close
- dispatch_async(xtoqDispatchQueue, ^{
- NSLog(@"Call xtoq_request_close(theContext)");
- xtoq_request_close(theContext);
+ dispatch_async(xcwmDispatchQueue, ^{
+ NSLog(@"Call xcwm_request_close(theContext)");
+ xcwm_request_close(theContext);
});
}
- (void) windowWillMove:(NSNotification*)notification {
//NSLog(@"window will move");
}
-- (void) updateImage:(xtoq_context_t *) windowContext
+- (void) updateImage:(xcwm_context_t *) windowContext
{
float y_transformed;
NSRect newDamageRect;
@@ -494,29 +494,29 @@
XtoqWindow *moveWindow = (XtoqWindow *)[NSApp mainWindow];
if (moveWindow != nil) {
- xtoq_context_t *moveContext = [moveWindow getContext];
+ xcwm_context_t *moveContext = [moveWindow getContext];
NSRect moveFrame = [moveWindow frame];
int x = (int)moveFrame.origin.x;
int y = [self osxToXserver:(int)moveFrame.origin.y
windowHeight:moveContext->height] - WINDOWBAR;
int width = (int)moveFrame.size.width;
int height = (int)moveFrame.size.height - WINDOWBAR;
- NSLog(@"Call xtoq_configure_window(moveContext, x = %i, y = %i, height = %i, width = %i)", x, y, height, width);
- xtoq_configure_window(moveContext, x, y - height, height, width);
+ NSLog(@"Call xcwm_configure_window(moveContext, x = %i, y = %i, height = %i, width = %i)", x, y, height, width);
+ xcwm_configure_window(moveContext, x, y - height, height, width);
}
}
@end
-void eventHandler (xtoq_event_t *event)
+void eventHandler (xcwm_event_t *event)
{
- xtoq_context_t *context = xtoq_event_get_context(event);
- if (xtoq_event_get_type(event) == XTOQ_DAMAGE) {
+ xcwm_context_t *context = xcwm_event_get_context(event);
+ if (xcwm_event_get_type(event) == XTOQ_DAMAGE) {
[referenceToSelf updateImage: context];
- } else if (xtoq_event_get_type(event) == XTOQ_CREATE) {
+ } else if (xcwm_event_get_type(event) == XTOQ_CREATE) {
NSLog(@"Window was created");
[referenceToSelf createNewWindow: context];
- } else if (xtoq_event_get_type(event) == XTOQ_DESTROY) {
+ } else if (xcwm_event_get_type(event) == XTOQ_DESTROY) {
NSLog(@"Window was destroyed");
[referenceToSelf destroyWindow: context];
} else {
diff --git a/src/xtoq/XtoqImageRep.h b/src/xtoq/XtoqImageRep.h
index 7e3a2e4..1f2c111 100644
--- a/src/xtoq/XtoqImageRep.h
+++ b/src/xtoq/XtoqImageRep.h
@@ -32,7 +32,7 @@
@interface XtoqImageRep : NSImageRep {
CGImageRef cgImage;
xcb_image_t *imageT;
- xtoq_image_t * imageParent;
+ xcwm_image_t * imageParent;
NSSize size;
CGFloat width;
CGFloat height;
@@ -66,7 +66,7 @@
* @param imageData The image from the Xserver that you want drawn
* @return id It returns its own id
*/
-- (id)initWithData:(xtoq_image_t *)imageData x:(int)x y:(int)y;
+- (id)initWithData:(xcwm_image_t *)imageData x:(int)x y:(int)y;
/**
* Return whether the window was drawn
diff --git a/src/xtoq/XtoqImageRep.m b/src/xtoq/XtoqImageRep.m
index c08759d..b14c0de 100644
--- a/src/xtoq/XtoqImageRep.m
+++ b/src/xtoq/XtoqImageRep.m
@@ -40,7 +40,7 @@
}
-- (id)initWithData:(xtoq_image_t *)imageData x:(int)x y:(int)y{
+- (id)initWithData:(xcwm_image_t *)imageData x:(int)x y:(int)y{
imageParent = imageData;
imageT = imageData->image;
self = [super init];
@@ -125,7 +125,7 @@
}
- (void)destroy{
if (imageParent) {
- xtoq_image_destroy(imageParent);
+ xcwm_image_destroy(imageParent);
}
}
diff --git a/src/xtoq/XtoqView.h b/src/xtoq/XtoqView.h
index b5810e7..fdd7b2e 100644
--- a/src/xtoq/XtoqView.h
+++ b/src/xtoq/XtoqView.h
@@ -32,7 +32,7 @@ SOFTWARE.
#import <xcwm/xcwm.h>
@interface XtoqView : NSView {
- xtoq_context_t *viewContext;
+ xcwm_context_t *viewContext;
//mouse event
NSPoint downPoint;
@@ -52,7 +52,7 @@ SOFTWARE.
* Set the context associated with this view.
* @param context The context
*/
--(void)setContext:(xtoq_context_t *)context;
+-(void)setContext:(xcwm_context_t *)context;
/**
* The OS X magic loop which is responsible for drawing content to the screen
diff --git a/src/xtoq/XtoqView.m b/src/xtoq/XtoqView.m
index 2feb66e..e75b0b3 100644
--- a/src/xtoq/XtoqView.m
+++ b/src/xtoq/XtoqView.m
@@ -48,7 +48,7 @@ initWithFrame:(NSRect)frame {
return self;
}
--(void) setContext: (xtoq_context_t *)context {
+-(void) setContext: (xcwm_context_t *)context {
viewContext = context;
}
@@ -56,12 +56,12 @@ initWithFrame:(NSRect)frame {
// passed-in rectangle.
-(void)
drawRect:(NSRect)dirtyRect {
- xtoq_image_t *imageT;
+ xcwm_image_t *imageT;
float y_transformed;
XtoqImageRep *imageNew;
- xtoq_get_event_thread_lock();
- imageT = test_xtoq_get_image(viewContext);
+ xcwm_get_event_thread_lock();
+ imageT = test_xcwm_get_image(viewContext);
if (imageT->image) {
y_transformed =( viewContext->height
- viewContext->damaged_y
@@ -74,9 +74,9 @@ drawRect:(NSRect)dirtyRect {
[imageNew destroy];
// Remove the damage
- xtoq_remove_context_damage(viewContext);
+ xcwm_remove_context_damage(viewContext);
}
- xtoq_release_event_thread_lock();
+ xcwm_release_event_thread_lock();
}
diff --git a/src/xtoq/XtoqWindow.h b/src/xtoq/XtoqWindow.h
index 1102941..1248502 100644
--- a/src/xtoq/XtoqWindow.h
+++ b/src/xtoq/XtoqWindow.h
@@ -26,7 +26,7 @@
#import "XtoqView.h"
@interface XtoqWindow : NSWindow {
- xtoq_context_t *winContext; // The context of the window.
+ xcwm_context_t *winContext; // The context of the window.
NSNotificationCenter * notificationCenter;
}
@@ -44,17 +44,17 @@
/**
* Used for setting member variables context and id.
*/
--(void) setContext: (xtoq_context_t *) aContext;
+-(void) setContext: (xcwm_context_t *) aContext;
/**
* Function for getting context of window from list.
*/
--(xtoq_context_t *) getContext;
+-(xcwm_context_t *) getContext;
/**
- * Sets the root window's pointer xtoqLocalData to the context's pointer.
+ * Sets the root window's pointer xcwmLocalData to the context's pointer.
*/
-//-(void) setRootDataPointer: (xtoq_context_t *) xqContext;
+//-(void) setRootDataPointer: (xcwm_context_t *) xqContext;
/**
* Catches the close event from clicking the red button or from preformClose.
diff --git a/src/xtoq/XtoqWindow.m b/src/xtoq/XtoqWindow.m
index ff02076..fdf6d32 100644
--- a/src/xtoq/XtoqWindow.m
+++ b/src/xtoq/XtoqWindow.m
@@ -50,11 +50,11 @@
[super makeKeyAndOrderFront:sender];
}
--(void) setContext:(xtoq_context_t *)aContext {
+-(void) setContext:(xcwm_context_t *)aContext {
winContext = aContext;
}
--(xtoq_context_t *) getContext {
+-(xcwm_context_t *) getContext {
return winContext;
}
@@ -73,8 +73,8 @@
-(void)windowDidBecomeKey:(NSNotification *)note {
- xtoq_set_input_focus(winContext);
- xtoq_set_window_to_top(winContext);
+ xcwm_set_input_focus(winContext);
+ xcwm_set_window_to_top(winContext);
}
@end