]> git.sur5r.net Git - i3/i3/commitdiff
Merge branch 'master' into next
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 4 Aug 2012 14:10:37 +0000 (16:10 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 4 Aug 2012 14:10:37 +0000 (16:10 +0200)
1  2 
src/commands.c
src/floating.c
src/randr.c

diff --cc src/commands.c
Simple merge
diff --cc src/floating.c
index 90c4d5607c26ff9fc7c838de77719909b51eb183,b90eac3e3fde78eb1da2ace2796affea5eafd2c7..0bc5f6d65aac466814b08c62350c5c4d6fe18d3b
@@@ -608,19 -607,24 +608,24 @@@ void floating_reposition(Con *con, Rec
   *
   */
  void floating_fix_coordinates(Con *con, Rect *old_rect, Rect *new_rect) {
-     DLOG("Fixing coordinates of floating window %p\n", con);
+     DLOG("Fixing coordinates of floating window %p (rect (%d, %d), %d x %d)\n",
+          con, con->rect.x, con->rect.y, con->rect.width, con->rect.height);
+     DLOG("old_rect = (%d, %d), %d x %d\n",
+          old_rect->x, old_rect->y, old_rect->width, old_rect->height);
+     DLOG("new_rect = (%d, %d), %d x %d\n",
+          new_rect->x, new_rect->y, new_rect->width, new_rect->height);
      /* First we get the x/y coordinates relative to the x/y coordinates
       * of the output on which the window is on */
-     uint32_t rel_x = (con->rect.x - old_rect->x);
-     uint32_t rel_y = (con->rect.y - old_rect->y);
+     int32_t rel_x = (con->rect.x - old_rect->x);
+     int32_t rel_y = (con->rect.y - old_rect->y);
      /* Then we calculate a fraction, for example 0.63 for a window
       * which is at y = 1212 of a 1920 px high output */
 -    double fraction_x = ((double)rel_x / (int32_t)old_rect->width);
 -    double fraction_y = ((double)rel_y / (int32_t)old_rect->height);
      DLOG("rel_x = %d, rel_y = %d, fraction_x = %f, fraction_y = %f, output->w = %d, output->h = %d\n",
 -         rel_x, rel_y, fraction_x, fraction_y, old_rect->width, old_rect->height);
 -    con->rect.x = (int32_t)new_rect->x + (fraction_x * (int32_t)new_rect->width);
 -    con->rect.y = (int32_t)new_rect->y + (fraction_y * (int32_t)new_rect->height);
 +          rel_x, rel_y, (double)rel_x / old_rect->width, (double)rel_y / old_rect->height,
 +          old_rect->width, old_rect->height);
 +    /* Here we have to multiply at first. Or we will lose precision when not compiled with -msse2 */
-     con->rect.x = new_rect->x + (double)(rel_x * new_rect->width)  / old_rect->width;
-     con->rect.y = new_rect->y + (double)(rel_y * new_rect->height) / old_rect->height;
++    con->rect.x = (int32_t)new_rect->x + (double)(rel_x * (int32_t)new_rect->width)  / (int32_t)old_rect->width;
++    con->rect.y = (int32_t)new_rect->y + (double)(rel_y * (int32_t)new_rect->height) / (int32_t)old_rect->height;
      DLOG("Resulting coordinates: x = %d, y = %d\n", con->rect.x, con->rect.y);
  }
  
diff --cc src/randr.c
Simple merge