summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cardell Widerkrantz <mc@hack.org>2012-03-05 11:39:37 +0100
committerMichael Cardell Widerkrantz <mc@hack.org>2012-03-05 11:39:37 +0100
commite68d58b454f32a95423048a288a543f4d6c29d01 (patch)
tree984223198be7cdddd8f0486b35f5f5a0d2292682
parent05b85be1e7bfb75e453920d452d05b50fdece3c9 (diff)
downloadmcwm-e68d58b454f32a95423048a288a543f4d6c29d01.zip
Only get the pointer position if we're going to use it when mapping a
new window. If we don't have the pointer position, use the window's coordinates to find the physical screen. Should have been used anyway.
-rw-r--r--mcwm.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/mcwm.c b/mcwm.c
index f15a4ff..814083f 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -978,8 +978,6 @@ void fitonscreen(struct client *client)
*/
void newwin(xcb_window_t win)
{
- int16_t pointx;
- int16_t pointy;
struct client *client;
if (NULL != findclient(win))
@@ -993,14 +991,6 @@ void newwin(xcb_window_t win)
return;
}
- /* Get pointer position so we can move the window to the cursor. */
- if (!getpointer(screen->root, &pointx, &pointy))
- {
- PDEBUG("Failed to get pointer coords!\n");
- pointx = 0;
- pointy = 0;
- }
-
/*
* Set up stuff, like borders, add the window to the client list,
* et cetera.
@@ -1017,12 +1007,23 @@ void newwin(xcb_window_t win)
/*
* If the client doesn't say the user specified the coordinates
- * for the window we store it where our pointer is instead.
+ * for the window we map it where our pointer is instead.
*/
if (!client->usercoord)
{
+ int16_t pointx;
+ int16_t pointy;
PDEBUG("Coordinates not set by user. Using pointer: %d,%d.\n",
pointx, pointy);
+
+ /* Get pointer position so we can move the window to the cursor. */
+ if (!getpointer(screen->root, &pointx, &pointy))
+ {
+ PDEBUG("Failed to get pointer coords!\n");
+ pointx = 0;
+ pointy = 0;
+ }
+
client->x = pointx;
client->y = pointy;
@@ -1036,7 +1037,7 @@ void newwin(xcb_window_t win)
/* Find the physical output this window will be on if RANDR is active. */
if (-1 != randrbase)
{
- client->monitor = findmonbycoord(pointx, pointy);
+ client->monitor = findmonbycoord(client->x, client->y);
if (NULL == client->monitor)
{
/*