projects
/
profile
/
ivi
/
weston.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ac63e5b
)
shell: Avoid modulo by zero error in positioning algorithm
author
Rob Bradford
<rob@linux.intel.com>
Mon, 13 Aug 2012 14:18:44 +0000
(15:18 +0100)
committer
Kristian Høgsberg
<krh@bitplanet.net>
Mon, 13 Aug 2012 15:12:17 +0000
(11:12 -0400)
As spotted by Philipp Brüschweiler <blei42@gmail.com>
src/shell.c
patch
|
blob
|
history
diff --git
a/src/shell.c
b/src/shell.c
index
9d969ff
..
4633049
100644
(file)
--- a/
src/shell.c
+++ b/
src/shell.c
@@
-2636,15
+2636,15
@@
weston_surface_set_initial_position (struct weston_surface *surface,
range_y = (target_output->current->height - panel_height) -
surface->geometry.height;
- if (range_x < 0)
- dx = 0;
- else
+ if (range_x > 0)
dx = random() % range_x;
-
- if (range_y < 0)
- dy = panel_height;
else
+ dx = 0;
+
+ if (range_y > 0)
dy = panel_height + random() % range_y;
+ else
+ dy = panel_height;
x = target_output->x + dx;
y = target_output->y + dy;