Bug 136151

Summary: Krita keeps producing windows when using Text tool with a tablet stylus
Product: krita Reporter: Eckhart Wörner <ewoerner>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.6   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Eckhart Wörner 2006-10-22 23:36:44 UTC
Version:           1.6 (using KDE KDE 3.5.5)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Steps to reproduce:
- Select the text tool
- Click somewhere into the image using a stylus
Current behaviour:
- Krita opens a lot of windows, in most cases does not stop producing new windows. This normally has the result of completely freezing graphical system.
Expected behaviour:
- Krita should not do this. ;-)
Comment 1 Eckhart Wörner 2006-10-28 11:49:34 UTC
Note: this is a regression; with version 1.5.2 it did not produce more than one window.
Comment 2 Cyrille Berger 2006-10-28 14:05:07 UTC
SVN commit 599736 by berger:

fix the text tool going made when use with the tablet in 1.6, don't close the bug as we might want a better solution for 2.0

CCBUG:136151


 M  +2 -2      kis_tool_fill.cc  
 M  +11 -1     kis_tool_text.cc  
 M  +2 -0      kis_tool_text.h  


--- branches/koffice/1.6/koffice/krita/plugins/tools/defaulttools/kis_tool_fill.cc #599735:599736
@@ -143,11 +143,11 @@
 
 void KisToolFill::buttonRelease(KisButtonReleaseEvent *e)
 {
-    if(!m_wasPressed) return;
-    m_wasPressed = false;
     if (!m_subject) return;
     if (!m_currentImage || !m_currentImage->activeDevice()) return;
     if (e->button() != QMouseEvent::LeftButton) return;
+    if(!m_wasPressed) return;
+    m_wasPressed = false;
     int x, y;
     x = m_startPos.floorX();
     y = m_startPos.floorY();
--- branches/koffice/1.6/koffice/krita/plugins/tools/defaulttools/kis_tool_text.cc #599735:599736
@@ -45,12 +45,13 @@
 #include "kis_tool_text.h"
 #include "kis_paint_device.h"
 #include "kis_canvas_subject.h"
+#include "kis_button_press_event.h"
 #include "kis_button_release_event.h"
 #include "kis_color.h"
 #include "kis_undo_adapter.h"
 
 KisToolText::KisToolText()
-    : super(i18n("Text"))
+    : super(i18n("Text")), m_wasPressed(false)
 {
     setName("tool_text");
     m_subject = 0;
@@ -67,9 +68,18 @@
     super::update(subject);
 }
 
+void KisToolText::buttonPress(KisButtonPressEvent *e)
+{
+    if (m_subject && e->button() == QMouseEvent::LeftButton) {
+      m_wasPressed = true;
+    }
+}
+
 void KisToolText::buttonRelease(KisButtonReleaseEvent *e)
 {
     if (m_subject && e->button() == QMouseEvent::LeftButton) {
+        if(!m_wasPressed) return;
+        m_wasPressed = false;
         KisImageSP img = m_subject->currentImg();
 
         bool ok;
--- branches/koffice/1.6/koffice/krita/plugins/tools/defaulttools/kis_tool_text.h #599735:599736
@@ -43,6 +43,7 @@
     virtual void setup(KActionCollection *collection);
     virtual enumToolType toolType() { return TOOL_FILL; }
     virtual Q_UINT32 priority() { return 2; }
+    virtual void buttonPress(KisButtonPressEvent*);
     virtual void buttonRelease(KisButtonReleaseEvent *e);
 
     virtual QWidget* createOptionWidget(QWidget* parent);
@@ -55,6 +56,7 @@
     QLabel *m_lbFont;
     KSqueezedTextLabel *m_lbFontName;
     QPushButton *m_btnMoreFonts;
+    bool m_wasPressed; // use for preventing bug:136151
 };
 
 
Comment 3 Eckhart Wörner 2006-11-01 22:09:23 UTC
Krita still produces a new window each time touching and releasing even if there's already a window, but this is no grave problem anymore.
Comment 4 Halla Rempt 2006-11-06 13:38:19 UTC
This is fixed too; I'm closing this bug since the text tool will be gone in 2.0, where we'll be using the flake text shape instead.