diff options
-rw-r--r-- | src/libxcwm/event_loop.c | 16 | ||||
-rw-r--r-- | src/libxcwm/input.c | 4 | ||||
-rw-r--r-- | src/libxcwm/window.c | 30 |
3 files changed, 29 insertions, 21 deletions
diff --git a/src/libxcwm/event_loop.c b/src/libxcwm/event_loop.c index e3f9913..681c168 100644 --- a/src/libxcwm/event_loop.c +++ b/src/libxcwm/event_loop.c @@ -42,9 +42,6 @@ pthread_t _event_thread = 0; pthread_mutex_t _event_thread_lock; -/* Mutex lock supplied to clients */ -/* pthread_mutex_t _event_thread_lock = 0; */ - /* Functions only called within event_loop.c */ void *run_event_loop(void *thread_arg_struct); @@ -181,7 +178,9 @@ void *run_event_loop (void *thread_arg_struct) case 0: { /* Error case. Something very bad has happened. Spit * out some hopefully useful information and then - * die. */ + * die. + * FIXME: Decide under what circumstances we should + * acutally kill the application. */ xcb_generic_error_t *err = (xcb_generic_error_t *)evt; fprintf(stderr, "Error received in event loop.\n" "Error code: %i\n", @@ -196,9 +195,6 @@ void *run_event_loop (void *thread_arg_struct) val_err->major_opcode, val_err->minor_opcode); } -/* fprintf(stderr, "Exiting....\n"); */ -/* free(evt); */ - /* exit(1); */ break; } case XCB_EXPOSE: { @@ -305,11 +301,13 @@ void *run_event_loop (void *thread_arg_struct) return NULL; } -int xcwm_event_get_type(xcwm_event_t const *event) { +int +xcwm_event_get_type(xcwm_event_t const *event) { return event->event_type; } -xcwm_context_t * xcwm_event_get_context(xcwm_event_t const *event) { +xcwm_context_t * +xcwm_event_get_context(xcwm_event_t const *event) { return event->context; } diff --git a/src/libxcwm/input.c b/src/libxcwm/input.c index 8beb594..12efbb7 100644 --- a/src/libxcwm/input.c +++ b/src/libxcwm/input.c @@ -75,8 +75,6 @@ void 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); + root_context->window, x, y, 0); xcb_flush(context->conn); - //printf("mouse motion received by xcwm.c - (%ld,%ld) in Mac window #%i\n", x, y, window); } diff --git a/src/libxcwm/window.c b/src/libxcwm/window.c index d02c871..5dbf1c0 100644 --- a/src/libxcwm/window.c +++ b/src/libxcwm/window.c @@ -56,7 +56,8 @@ xcwm_set_window_to_top(xcwm_context_t *context) { const static uint32_t values[] = { XCB_STACK_MODE_ABOVE }; /* Move the window on the top of the stack */ - xcb_configure_window (context->conn, context->window, XCB_CONFIG_WINDOW_STACK_MODE, values); + xcb_configure_window (context->conn, context->window, + XCB_CONFIG_WINDOW_STACK_MODE, values); } /* Set window to the bottom of the stack */ @@ -66,7 +67,8 @@ xcwm_set_window_to_bottom(xcwm_context_t *context) { const static uint32_t values[] = { XCB_STACK_MODE_BELOW }; /* Move the window on the top of the stack */ - xcb_configure_window (context->conn, context->window, XCB_CONFIG_WINDOW_STACK_MODE, values); + xcb_configure_window (context->conn, context->window, + XCB_CONFIG_WINDOW_STACK_MODE, values); } /* Set input focus to window */ @@ -75,13 +77,16 @@ xcwm_set_input_focus(xcwm_context_t *context) { // Test -- David xcb_get_input_focus_cookie_t cookie = xcb_get_input_focus(context->conn); - xcb_get_input_focus_reply_t *reply = xcb_get_input_focus_reply(context->conn, cookie, NULL); - printf("Focus was in window #%d, now in #%d (window.c)\n", reply->focus, context->window); + xcb_get_input_focus_reply_t *reply = + xcb_get_input_focus_reply(context->conn, cookie, NULL); + printf("Focus was in window #%d, now in #%d (window.c)\n", + reply->focus, context->window); free(reply); // End test -- David - xcb_set_input_focus(context->conn, XCB_INPUT_FOCUS_PARENT, context->window, XCB_CURRENT_TIME); + xcb_set_input_focus(context->conn, XCB_INPUT_FOCUS_PARENT, + context->window, XCB_CURRENT_TIME); xcb_flush(context->conn); } @@ -126,7 +131,8 @@ _xcwm_window_created(xcb_connection_t * conn, xcb_map_request_event_t *event) { xcwm_context_t * _xcwm_destroy_window(xcb_destroy_notify_event_t *event) { - xcwm_context_t *context = _xcwm_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; @@ -150,10 +156,16 @@ xcwm_configure_window(xcwm_context_t *context, int x, int y, int height, int wid context->width = width; context->height = height; - uint32_t values[] = {(uint32_t)x, (uint32_t)y, (uint32_t)width, (uint32_t)height }; + uint32_t values[] = {(uint32_t)x, (uint32_t)y, + (uint32_t)width, (uint32_t)height }; - xcb_configure_window (context->conn, context->window, XCB_CONFIG_WINDOW_X - | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values); + xcb_configure_window (context->conn, + context->window, + XCB_CONFIG_WINDOW_X | + XCB_CONFIG_WINDOW_Y | + XCB_CONFIG_WINDOW_WIDTH | + XCB_CONFIG_WINDOW_HEIGHT, + values); /* Set the damage area to the new window size so its redrawn properly */ context->damaged_width = width; |