Permalink
Browse files

[Fixes bug #1080340] Fix issues with the Ctrl key in the text tool.

  • Loading branch information...
1 parent 582a3bd commit aa0425d124936ac7dba972289523fd84c4b65155 @cameronwhite cameronwhite committed Nov 23, 2012
Showing with 11 additions and 10 deletions.
  1. +11 −10 Pinta.Tools/Tools/TextTool.cs
@@ -501,6 +501,8 @@ protected override void OnDeactivated ()
#region Mouse Handlers
protected override void OnMouseDown(DrawingArea canvas, ButtonPressEventArgs args, Cairo.PointD point)
{
+ ctrlKey = (args.Event.State & ModifierType.ControlMask) != 0;
+
//Store the mouse position.
Point pt = point.ToGdkPoint();
@@ -610,6 +612,8 @@ protected override void OnMouseDown(DrawingArea canvas, ButtonPressEventArgs arg
protected override void OnMouseMove (object o, MotionNotifyEventArgs args, Cairo.PointD point)
{
+ ctrlKey = (args.Event.State & ModifierType.ControlMask) != 0;
+
lastMousePosition = point.ToGdkPoint();
// If we're dragging the text around, do that
@@ -624,7 +628,7 @@ protected override void OnMouseMove (object o, MotionNotifyEventArgs args, Cairo
}
else
{
- updateMouseCursor();
+ UpdateMouseCursor();
}
}
@@ -643,7 +647,7 @@ protected override void OnMouseUp (Gtk.DrawingArea canvas, Gtk.ButtonReleaseEven
}
}
- private void updateMouseCursor()
+ private void UpdateMouseCursor()
{
//Whether or not to show the normal text cursor.
bool showNormalCursor = false;
@@ -712,12 +716,8 @@ protected override void OnKeyDown (DrawingArea canvas, KeyPressEventArgs args)
if ((modifier & Gdk.ModifierType.Mod1Mask) != 0)
return;
- if (args.Event.Key == Gdk.Key.Control_L || args.Event.Key == Gdk.Key.Control_R)
- {
- ctrlKey = true;
-
- updateMouseCursor();
- }
+ ctrlKey = (args.Event.Key == Gdk.Key.Control_L || args.Event.Key == Gdk.Key.Control_R);
+ UpdateMouseCursor ();
// Assume that we are going to handle the key
bool keyHandled = true;
@@ -828,11 +828,12 @@ protected override void OnKeyDown (DrawingArea canvas, KeyPressEventArgs args)
protected override void OnKeyUp(DrawingArea canvas, KeyReleaseEventArgs args)
{
- if (args.Event.Key == Gdk.Key.Control_L || args.Event.Key == Gdk.Key.Control_R)
+ if (args.Event.Key == Gdk.Key.Control_L || args.Event.Key == Gdk.Key.Control_R ||
+ (args.Event.State & ModifierType.ControlMask) != 0)
{
ctrlKey = false;
- updateMouseCursor();
+ UpdateMouseCursor();
}
}

0 comments on commit aa0425d

Please sign in to comment.