X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fmoveresize.c;h=7bfee102027e499f887e6ce72484b7122737da78;hb=e2ddfaf9fff1fb9dd6ebdc1a95f2b228d6baedb2;hp=07b8e22b5d163837240ff41f51ca8d29a60f6743;hpb=17bc51aab8be25cd44c55eb0a652c92518bd9b0f;p=chaz%2Fopenbox diff --git a/openbox/moveresize.c b/openbox/moveresize.c index 07b8e22b..7bfee102 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -25,16 +25,15 @@ #include "frame.h" #include "openbox.h" #include "resist.h" -#include "mainloop.h" #include "modkeys.h" #include "popup.h" #include "moveresize.h" #include "config.h" #include "event.h" #include "debug.h" -#include "extensions.h" #include "render/render.h" #include "render/theme.h" +#include "obt/display.h" #include #include @@ -116,36 +115,42 @@ static void popup_coords(ObClient *c, const gchar *format, gint a, gint b) Rect *area = screen_physical_area_active(); gint gravity, x, y; - x = config_resize_popup_x; - if (config_resize_popup_x_center) x = area->x + area->width/2; - else if (config_resize_popup_x_opposite) x = RECT_RIGHT(*area) - x; - else x = area->x + x; + x = config_resize_popup_fixed.x.pos; + if (config_resize_popup_fixed.x.center) + x = area->x + area->width/2; + else if (config_resize_popup_fixed.x.opposite) + x = RECT_RIGHT(*area) - x; + else + x = area->x + x; - y = config_resize_popup_y; - if (config_resize_popup_y_center) y = area->y + area->height/2; - else if (config_resize_popup_y_opposite) y = RECT_BOTTOM(*area) - y; - else y = area->y + y; + y = config_resize_popup_fixed.y.pos; + if (config_resize_popup_fixed.y.center) + y = area->y + area->height/2; + else if (config_resize_popup_fixed.y.opposite) + y = RECT_RIGHT(*area) - y; + else + y = area->y + y; - if (config_resize_popup_x_center) { - if (config_resize_popup_y_center) + if (config_resize_popup_fixed.x.center) { + if (config_resize_popup_fixed.y.center) gravity = CenterGravity; - else if (config_resize_popup_y_opposite) + else if (config_resize_popup_fixed.y.opposite) gravity = SouthGravity; else gravity = NorthGravity; } - else if (config_resize_popup_x_opposite) { - if (config_resize_popup_y_center) + else if (config_resize_popup_fixed.x.opposite) { + if (config_resize_popup_fixed.y.center) gravity = EastGravity; - else if (config_resize_popup_y_opposite) + else if (config_resize_popup_fixed.y.opposite) gravity = SouthEastGravity; else gravity = NorthEastGravity; } else { - if (config_resize_popup_y_center) + if (config_resize_popup_fixed.y.center) gravity = WestGravity; - else if (config_resize_popup_y_opposite) + else if (config_resize_popup_fixed.y.opposite) gravity = SouthWestGravity; else gravity = NorthWestGravity; @@ -245,7 +250,7 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr) moveresize_in_progress = TRUE; #ifdef SYNC - if (config_resize_redraw && !moving && extensions_sync && + if (config_resize_redraw && !moving && obt_display_extension_sync && moveresize_client->sync_request && moveresize_client->sync_counter) { /* Initialize values for the resize syncing, and create an alarm for @@ -256,7 +261,7 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr) /* set the counter to an initial value */ XSyncIntToValue(&val, 0); - XSyncSetCounter(ob_display, moveresize_client->sync_counter, val); + XSyncSetCounter(obt_display, moveresize_client->sync_counter, val); /* this will be incremented when we tell the client what we're looking for */ @@ -272,7 +277,7 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr) aa.trigger.test_type = XSyncPositiveTransition; aa.events = True; XSyncIntToValue(&aa.delta, 1); - moveresize_alarm = XSyncCreateAlarm(ob_display, + moveresize_alarm = XSyncCreateAlarm(obt_display, XSyncCACounter | XSyncCAValue | XSyncCAValueType | @@ -301,11 +306,11 @@ void moveresize_end(gboolean cancel) #ifdef SYNC /* turn off the alarm */ if (moveresize_alarm != None) { - XSyncDestroyAlarm(ob_display, moveresize_alarm); + XSyncDestroyAlarm(obt_display, moveresize_alarm); moveresize_alarm = None; } - ob_main_loop_timeout_remove(ob_main_loop, sync_timeout_func); + obt_main_loop_timeout_remove(ob_main_loop, sync_timeout_func); #endif client_configure(moveresize_client, @@ -360,7 +365,7 @@ static void do_resize(void) } #ifdef SYNC - if (config_resize_redraw && extensions_sync && + if (config_resize_redraw && obt_display_extension_sync && moveresize_client->sync_request && moveresize_client->sync_counter) { XEvent ce; @@ -377,7 +382,7 @@ static void do_resize(void) /* tell the client what we're waiting for */ ce.xclient.type = ClientMessage; ce.xclient.message_type = prop_atoms.wm_protocols; - ce.xclient.display = ob_display; + ce.xclient.display = obt_display; ce.xclient.window = moveresize_client->window; ce.xclient.format = 32; ce.xclient.data.l[0] = prop_atoms.net_wm_sync_request; @@ -385,15 +390,15 @@ static void do_resize(void) ce.xclient.data.l[2] = XSyncValueLow32(val); ce.xclient.data.l[3] = XSyncValueHigh32(val); ce.xclient.data.l[4] = 0l; - XSendEvent(ob_display, moveresize_client->window, FALSE, + XSendEvent(obt_display, moveresize_client->window, FALSE, NoEventMask, &ce); waiting_for_sync = TRUE; - ob_main_loop_timeout_remove(ob_main_loop, sync_timeout_func); - ob_main_loop_timeout_add(ob_main_loop, G_USEC_PER_SEC * 2, - sync_timeout_func, - NULL, NULL, NULL); + obt_main_loop_timeout_remove(ob_main_loop, sync_timeout_func); + obt_main_loop_timeout_add(ob_main_loop, G_USEC_PER_SEC * 2, + sync_timeout_func, + NULL, NULL, NULL); } #endif @@ -572,10 +577,10 @@ static void do_edge_warp(gint x, gint y) cancel_edge_warp(); if (dir != (ObDirection)-1) { edge_warp_odd = TRUE; /* switch on the first timeout */ - ob_main_loop_timeout_add(ob_main_loop, - config_mouse_screenedgetime * 1000, - edge_warp_delay_func, - NULL, NULL, NULL); + obt_main_loop_timeout_add(ob_main_loop, + config_mouse_screenedgetime * 1000, + edge_warp_delay_func, + NULL, NULL, NULL); } edge_warp_dir = dir; } @@ -583,7 +588,7 @@ static void do_edge_warp(gint x, gint y) static void cancel_edge_warp(void) { - ob_main_loop_timeout_remove(ob_main_loop, edge_warp_delay_func); + obt_main_loop_timeout_remove(ob_main_loop, edge_warp_delay_func); } static void move_with_keys(gint keycode, gint state) @@ -627,12 +632,12 @@ static void move_with_keys(gint keycode, gint state) } screen_pointer_pos(&opx, &opy); - XWarpPointer(ob_display, None, None, 0, 0, 0, 0, dx, dy); + XWarpPointer(obt_display, None, None, 0, 0, 0, 0, dx, dy); /* steal the motion events this causes */ - XSync(ob_display, FALSE); + XSync(obt_display, FALSE); { XEvent ce; - while (XCheckTypedEvent(ob_display, MotionNotify, &ce)); + while (XCheckTypedEvent(obt_display, MotionNotify, &ce)); } screen_pointer_pos(&px, &py); @@ -784,12 +789,12 @@ static void resize_with_keys(gint keycode, gint state) pdy = dh; screen_pointer_pos(&opx, &opy); - XWarpPointer(ob_display, None, None, 0, 0, 0, 0, pdx, pdy); + XWarpPointer(obt_display, None, None, 0, 0, 0, 0, pdx, pdy); /* steal the motion events this causes */ - XSync(ob_display, FALSE); + XSync(obt_display, FALSE); { XEvent ce; - while (XCheckTypedEvent(ob_display, MotionNotify, &ce)); + while (XCheckTypedEvent(obt_display, MotionNotify, &ce)); } screen_pointer_pos(&px, &py); @@ -918,7 +923,7 @@ gboolean moveresize_event(XEvent *e) } } #ifdef SYNC - else if (e->type == extensions_sync_event_basep + XSyncAlarmNotify) + else if (e->type == obt_display_extension_sync_basep + XSyncAlarmNotify) { waiting_for_sync = FALSE; /* we got our sync... */ do_resize(); /* ...so try resize if there is more change pending */