place_client(self, &x, &y);
- /* make sure the window is visible */
+ /* make sure the window is visible. */
client_find_onscreen(self, &x, &y,
self->frame->area.width,
self->frame->area.height,
do also. we can assume you want it back where
you saved it */
client_normal(self) && !self->session);
-
- if (x != ox || y != oy)
+ if (x != ox || y != oy)
client_move(self, x, y);
}
+ keyboard_grab_for_client(self, TRUE);
+ mouse_grab_for_client(self, TRUE);
+
client_showhide(self);
/* use client_focus instead of client_activate cuz client_activate does
/* update the list hints */
client_set_list();
- keyboard_grab_for_client(self, TRUE);
- mouse_grab_for_client(self, TRUE);
-
ob_debug("Managed window 0x%lx (%s)\n", window, self->class);
}
would be */
/* XXX watch for xinerama dead areas */
-
+ /* This makes sure windows aren't entirely outside of the screen so you
+ * can't see them at all */
a = screen_area(self->desktop);
if (client_normal(self)) {
if (!self->strut.right && *x >= a->x + a->width - 1)
*y = a->y;
}
- if (rude) {
- /* this is my MOZILLA BITCHSLAP. oh ya it fucking feels good.
- Java can suck it too. */
+ /* This here doesn't let windows even a pixel outside the screen,
+ * not applied to all windows. Not sure if it's going to stay at all.
+ * I wonder if disabling this will break struts somehow? Let's find out. */
+ if (0 && rude) {
+ /* avoid the xinerama monitor divide while we're at it,
+ * remember to fix the placement stuff to avoid it also and
+ * then remove this XXX */
+ a = screen_physical_area_monitor(client_monitor(self));
+ /* this is ben's MOZILLA BITCHSLAP. "oh ya it fucking feels good.
+ Java can suck it too." */
/* dont let windows map/move into the strut unless they
are bigger than the available area */
else if (self->type == OB_CLIENT_TYPE_DESKTOP)
l = OB_STACKING_LAYER_DESKTOP;
else if (self->type == OB_CLIENT_TYPE_DOCK) {
- if (self->above) l = OB_STACKING_LAYER_DOCK_ABOVE;
- else if (self->below) l = OB_STACKING_LAYER_DOCK_BELOW;
- else l = OB_STACKING_LAYER_DOCK_NORMAL;
+ if (self->below) l = OB_STACKING_LAYER_NORMAL;
+ else l = OB_STACKING_LAYER_ABOVE;
}
else if (self->above) l = OB_STACKING_LAYER_ABOVE;
else if (self->below) l = OB_STACKING_LAYER_BELOW;
if (self->undecorated != undecorated) {
self->undecorated = undecorated;
client_setup_decor_and_functions(self);
+ /* Make sure the client knows it might have moved. Maybe there is a
+ * better way of doing this so only one client_configure is sent, but
+ * since 125 of these are sent per second when moving the window (with
+ * user = FALSE) i doubt it matters much.
+ */
+ client_configure(self, OB_CORNER_TOPLEFT, self->area.x, self->area.y,
+ self->area.width, self->area.height, TRUE, TRUE);
client_change_state(self); /* reflect this in the state hints */
}
}
+/* Determines which physical monitor a client is on by calculating the
+ area of the part of the client on each monitor. The number of the
+ monitor containing the greatest area of the client is returned.*/
guint client_monitor(ObClient *self)
{
guint i;
*/
gint client_directional_edge_search(ObClient *c, ObDirection dir)
{
- gint dest;
+ gint dest, monitor_dest;
gint my_edge_start, my_edge_end, my_offset;
GList *it;
- Rect *a;
+ Rect *a, *monitor;
if(!client_list)
return -1;
a = screen_area(c->desktop);
+ monitor = screen_area_monitor(c->desktop, client_monitor(c));
switch(dir) {
case OB_DIRECTION_NORTH:
/* default: top of screen */
dest = a->y;
+ monitor_dest = monitor->y;
+ /* if the monitor edge comes before the screen edge, */
+ /* use that as the destination instead. (For xinerama) */
+ if (monitor_dest != dest && my_offset > monitor_dest)
+ dest = monitor_dest;
- for(it = client_list; it; it = g_list_next(it)) {
+ for(it = client_list; it && my_offset != dest; it = g_list_next(it)) {
gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data;
/* default: bottom of screen */
dest = a->y + a->height;
+ monitor_dest = monitor->y + monitor->height;
+ /* if the monitor edge comes before the screen edge, */
+ /* use that as the destination instead. (For xinerama) */
+ if (monitor_dest != dest && my_offset < monitor_dest)
+ dest = monitor_dest;
- for(it = client_list; it; it = g_list_next(it)) {
+ for(it = client_list; it && my_offset != dest; it = g_list_next(it)) {
gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data;
/* default: leftmost egde of screen */
dest = a->x;
+ monitor_dest = monitor->x;
+ /* if the monitor edge comes before the screen edge, */
+ /* use that as the destination instead. (For xinerama) */
+ if (monitor_dest != dest && my_offset > monitor_dest)
+ dest = monitor_dest;
- for(it = client_list; it; it = g_list_next(it)) {
+ for(it = client_list; it && my_offset != dest; it = g_list_next(it)) {
gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data;
/* default: rightmost edge of screen */
dest = a->x + a->width;
+ monitor_dest = monitor->x + monitor->width;
+ /* if the monitor edge comes before the screen edge, */
+ /* use that as the destination instead. (For xinerama) */
+ if (monitor_dest != dest && my_offset < monitor_dest)
+ dest = monitor_dest;
- for(it = client_list; it; it = g_list_next(it)) {
+ for(it = client_list; it && my_offset != dest; it = g_list_next(it)) {
gint his_edge_start, his_edge_end, his_offset;
ObClient *cur = it->data;