~ubuntu-branches/ubuntu/wily/xfwm4/wily

« back to all changes in this revision

Viewing changes to debian/patches/0003-Some-small-optimizations-in-placement-code.patch

  • Committer: Package Import Robot
  • Author(s): Micah Gersten
  • Date: 2013-08-08 22:00:03 UTC
  • mfrom: (3.2.9 sid)
  • Revision ID: package-import@ubuntu.com-20130808220003-p1lagfezt2kcrs42
Tags: 4.10.1-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - debian/control: demote xfwm4-themes from Recommends to Suggests, per
    the 'other-p-xubuntu-cleanthemes' spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From e207a6bb16b5396544fa57e0b5cb5e621e8eaefb Mon Sep 17 00:00:00 2001
2
 
From: Nick Schermer <nick@xfce.org>
3
 
Date: Fri, 30 Nov 2012 22:50:59 +0100
4
 
Subject: [PATCH] Some small optimizations in placement code.
5
 
 
6
 
Callgrind showed that the frameX/Y functions were called
7
 
a lot, so save the result inside the loop to do less calls.
8
 
 
9
 
Also inline the overlap functions, both are just simple calculations
10
 
so help the compiler a bit.
11
 
---
12
 
 src/placement.c |   17 +++++++++++------
13
 
 1 file changed, 11 insertions(+), 6 deletions(-)
14
 
 
15
 
diff --git a/src/placement.c b/src/placement.c
16
 
index f926de3..01f2590 100644
17
 
--- a/src/placement.c
18
 
+++ b/src/placement.c
19
 
@@ -38,9 +38,10 @@
20
 
 #include "frame.h"
21
 
 #include "netwm.h"
22
 
 
23
 
+
24
 
 /* Compute rectangle overlap area */
25
 
 
26
 
-static unsigned long
27
 
+static inline unsigned long
28
 
 segment_overlap (int x0, int x1, int tx0, int tx1)
29
 
 {
30
 
     if (tx0 > x0)
31
 
@@ -58,7 +59,7 @@ segment_overlap (int x0, int x1, int tx0, int tx1)
32
 
     return (x1 - x0);
33
 
 }
34
 
 
35
 
-static unsigned long
36
 
+static inline unsigned long
37
 
 overlap (int x0, int y0, int x1, int y1, int tx0, int ty0, int tx1, int ty1)
38
 
 {
39
 
     /* Compute overlapping box */
40
 
@@ -541,6 +542,7 @@ smartPlacement (Client * c, int full_x, int full_y, int full_w, int full_h)
41
 
     gint test_x, test_y, xmax, ymax, best_x, best_y;
42
 
     gint frame_height, frame_width, frame_left, frame_top;
43
 
     gboolean first;
44
 
+    gint c2_x, c2_y;
45
 
 
46
 
     g_return_if_fail (c != NULL);
47
 
     TRACE ("entering smartPlacement");
48
 
@@ -574,14 +576,17 @@ smartPlacement (Client * c, int full_x, int full_y, int full_w, int full_h)
49
 
                     && (c->win_workspace == c2->win_workspace)
50
 
                     && FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_VISIBLE))
51
 
                 {
52
 
+                    c2_x = frameX (c2);
53
 
+                    c2_y = frameY (c2);
54
 
+
55
 
                     count_overlaps += overlap (test_x - frame_left,
56
 
                                                test_y - frame_top,
57
 
                                                test_x - frame_left + frame_width,
58
 
                                                test_y - frame_top + frame_height,
59
 
-                                               frameX (c2),
60
 
-                                               frameY (c2),
61
 
-                                               frameX (c2) + frameWidth (c2),
62
 
-                                               frameY (c2) + frameHeight (c2));
63
 
+                                               c2_x,
64
 
+                                               c2_y,
65
 
+                                               c2_x + frameWidth (c2),
66
 
+                                               c2_y + frameHeight (c2));
67
 
                 }
68
 
             }
69
 
             if (count_overlaps < 0.1)
70
 
1.7.10.4
71