]>
Dogcows Code - chaz/openbox/blob - moveto.c
7cc6541dbfa481236bf0673dfd7c9ab3645d43c9
1 #include "openbox/actions.h"
2 #include "openbox/client.h"
3 #include "openbox/screen.h"
4 #include "openbox/frame.h"
5 #include <stdlib.h> /* for atoi */
15 static gpointer
setup_func(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
);
16 static void free_func(gpointer options
);
17 static gboolean
run_func(ObActionsData
*data
, gpointer options
);
19 void action_moveto_startup()
21 actions_register("MoveTo",
28 static gpointer
setup_func(ObParseInst
*i
, xmlDocPtr doc
, xmlNodePtr node
)
33 o
= g_new0(Options
, 1);
38 if ((n
= parse_find_node("x", node
))) {
39 gchar
*s
= parse_string(doc
, n
);
40 if (!g_ascii_strcasecmp(s
, "center"))
47 if ((n
= parse_find_node("y", node
))) {
48 gchar
*s
= parse_string(doc
, n
);
49 if (!g_ascii_strcasecmp(s
, "center"))
56 if ((n
= parse_find_node("monitor", node
)))
57 o
->monitor
= parse_int(doc
, n
) - 1;
62 static void free_func(gpointer options
)
69 /* Always return FALSE because its not interactive */
70 static gboolean
run_func(ObActionsData
*data
, gpointer options
)
78 gint x
, y
, lw
, lh
, w
, h
;
82 cmon
= client_monitor(c
);
83 if (mon
< 0) mon
= cmon
;
84 area
= screen_area(c
->desktop
, mon
, NULL
);
85 carea
= screen_area(c
->desktop
, cmon
, NULL
);
87 if (x
== G_MININT
) x
= c
->frame
->area
.x
- carea
->x
;
88 if (o
->xcenter
) x
= (area
->width
- c
->frame
->area
.width
) / 2;
91 if (y
== G_MININT
) y
= c
->frame
->area
.y
- carea
->y
;
92 if (o
->ycenter
) y
= (area
->height
- c
->frame
->area
.height
) / 2;
97 frame_frame_gravity(c
->frame
, &x
, &y
); /* get the client coords */
98 client_try_configure(c
, &x
, &y
, &w
, &h
, &lw
, &lh
, TRUE
);
99 /* force it on screen if its moving to another monitor */
100 client_find_onscreen(c
, &x
, &y
, w
, h
, mon
!= cmon
);
102 actions_client_move(data
, TRUE
);
103 client_configure(c
, x
, y
, w
, h
, TRUE
, TRUE
, FALSE
);
104 actions_client_move(data
, FALSE
);
This page took 0.043224 seconds and 3 git commands to generate.