[meld/ui-next: 33/35] diffgrid: Fix handle drawing and prelight setting
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld/ui-next: 33/35] diffgrid: Fix handle drawing and prelight setting
- Date: Sat, 16 Feb 2019 21:46:34 +0000 (UTC)
commit ac69b35f1691be0bb5ce71261c9b835cb9b38950
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Feb 16 08:35:57 2019 +1000
diffgrid: Fix handle drawing and prelight setting
The prelight changes are just a refactor. The handle drawing has
probably always been like this, but wasn't visible due to theme
interactions (see 5e2691e02cc922ff14146bc9b5798cdb4f177d33).
meld/diffgrid.py | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/meld/diffgrid.py b/meld/diffgrid.py
index f4146240..3b4a8ba8 100644
--- a/meld/diffgrid.py
+++ b/meld/diffgrid.py
@@ -58,16 +58,17 @@ class DiffGrid(Gtk.Grid):
def _handle_set_prelight(self, window, flag):
if hasattr(window, "handle"):
window.handle.set_prelight(flag)
- return True
- return False
def do_enter_notify_event(self, event):
- return self._handle_set_prelight(event.window, True)
+ if hasattr(event.window, "handle"):
+ event.window.handle.set_prelight(True)
def do_leave_notify_event(self, event):
- if not self._in_drag:
- return self._handle_set_prelight(event.window, False)
- return False
+ if self._in_drag:
+ return
+
+ if hasattr(event.window, "handle"):
+ event.window.handle.set_prelight(False)
def do_button_press_event(self, event):
if event.button & Gdk.BUTTON_PRIMARY:
@@ -241,6 +242,11 @@ class DiffGrid(Gtk.Grid):
class HandleWindow():
+
+ # We restrict the handle width because render_handle doesn't pay
+ # attention to orientation.
+ handle_width = 10
+
def __init__(self):
self._widget = None
self._window = None
@@ -330,10 +336,13 @@ class HandleWindow():
stylecontext.save()
stylecontext.set_state(state)
stylecontext.add_class(Gtk.STYLE_CLASS_PANE_SEPARATOR)
+ stylecontext.add_class(Gtk.STYLE_CLASS_VERTICAL)
color = stylecontext.get_background_color(state)
if color.alpha > 0.0:
- Gtk.render_handle(stylecontext, cairocontext,
- x, y, width, height)
+ xcenter = x + width / 2.0 - self.handle_width / 2.0
+ Gtk.render_handle(
+ stylecontext, cairocontext,
+ xcenter, y, self.handle_width, height)
else:
xcenter = x + width / 2.0
Gtk.render_line(stylecontext, cairocontext,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]