Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gajim
gajim
Commits
a6a54d49
Commit
a6a54d49
authored
Nov 07, 2021
by
Philipp Hörist
Browse files
Simplify code
parent
efb14b29
Changes
2
Hide whitespace changes
Inline
Side-by-side
gajim/gtk/avatar_selector.py
View file @
a6a54d49
...
...
@@ -390,14 +390,10 @@ def _on_motion_notify(self, _widget, event):
top
+=
delta_y
bottom
+=
delta_y
if
left
<
0
:
left
=
0
if
top
<
0
:
top
=
0
if
right
>
pb_width
:
right
=
pb_width
if
bottom
>
pb_height
:
bottom
=
pb_height
left
=
max
(
left
,
0
)
top
=
max
(
top
,
0
)
right
=
min
(
right
,
pb_width
)
bottom
=
min
(
bottom
,
pb_height
)
adj_width
=
int
(
right
-
left
+
1
)
adj_height
=
int
(
bottom
-
top
+
1
)
...
...
@@ -501,14 +497,10 @@ def _on_motion_notify(self, _widget, event):
width
=
right
-
left
+
1
height
=
bottom
-
top
+
1
if
self
.
_aspect
<
0
:
if
left
<
0
:
left
=
0
if
top
<
0
:
top
=
0
if
right
>
pb_width
:
right
=
pb_width
if
bottom
>
pb_height
:
bottom
=
pb_height
left
=
max
(
left
,
0
)
top
=
max
(
top
,
0
)
right
=
min
(
right
,
pb_width
)
bottom
=
min
(
bottom
,
pb_height
)
width
=
right
-
left
+
1
height
=
bottom
-
top
+
1
...
...
gajim/gtk/util.py
View file @
a6a54d49
...
...
@@ -313,10 +313,8 @@ def resize_window(window: Gtk.Window, width: int, height: int) -> None:
screen_w
,
screen_h
=
get_total_screen_geometry
()
if
not
width
or
not
height
:
return
if
width
>
screen_w
:
width
=
screen_w
if
height
>
screen_h
:
height
=
screen_h
width
=
min
(
width
,
screen_w
)
height
=
min
(
height
,
screen_h
)
window
.
resize
(
abs
(
width
),
abs
(
height
))
...
...
@@ -325,10 +323,9 @@ def move_window(window: Gtk.Window, pos_x: int, pos_y: int) -> None:
Move the window, but also check if out of screen
"""
screen_w
,
screen_h
=
get_total_screen_geometry
()
if
pos_x
<
0
:
pos_x
=
0
if
pos_y
<
0
:
pos_y
=
0
pos_x
=
max
(
pos_x
,
0
)
pos_y
=
max
(
pos_y
,
0
)
width
,
height
=
window
.
get_size
()
if
pos_x
+
width
>
screen_w
:
pos_x
=
screen_w
-
width
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment