[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KDE 3.5.7
From:       Alexander Wiedenbruch <wirr01 () gmail ! com>
Date:       2007-04-16 17:19:44
Message-ID: 200704161919.45016.wirr01 () gmail ! com
[Download RAW message or body]

Hello,

I hope it is still possible to add features to the KDE 3.5.7 release.

I would like to get permission to add a bugfix/feature to SuperKaramba.
With the patch themes will receive mouse wheel events additionaly to button 
events on meter (images, text, ...) as it would be expected. Currently this 
works only on the whole SuperKaramba widget but not on meters.

This behaviour will be default in KDE 4. Unfortunately this 'bugfix' needs to 
be enabled by the theme to keep backward compatibilty for not well coded 
themes.

Approved by Ryan Nickell (current maintainer)
Tested by Daniel Dotsenko and myself

Thanks!
Alex

["wheel.patch" (text/x-diff)]

Index: karamba.cpp
===================================================================
--- karamba.cpp	(Revision 638305)
+++ karamba.cpp	(Arbeitskopie)
@@ -64,6 +64,7 @@
 {
   themeStarted = false;
   want_right_button = false;
+  want_meter_wheel_event = false;
   prettyName = name;
   m_sub_theme = sub_theme;
 
@@ -1374,6 +1375,35 @@
     else
       button = 5;
 
+    // We create a temporary click list here because original
+    // can change during the loop (infinite loop Bug 994359)
+    if (want_meter_wheel_event)
+    {
+      QObjectList clickListTmp(*clickList);
+      QObjectListIt it(clickListTmp);
+
+      QMouseEvent fakeEvent(QEvent::MouseButtonPress, e->pos(), e->globalPos(), button, e->state());
+
+      while (it != 0)
+      {
+        Meter* meter = (Meter*)(*it);
+        // Check if meter is still in list
+        if (clickList->containsRef(meter) && meter->click(&fakeEvent))
+        {
+          if (RichTextLabel* richText = dynamic_cast<RichTextLabel*>(meter))
+          {
+            pythonIface->meterClicked(this, richText->anchorAt(fakeEvent.x(), fakeEvent.y()),
+                                    button);
+          }
+          else
+          {
+            pythonIface->meterClicked(this, meter, button);
+          }
+        }
+        ++it;
+      }
+    }
+
     pythonIface->widgetClicked(this, e->x(), e->y(), button);
   }
 }
Index: karamba.h
===================================================================
--- karamba.h	(Revision 638305)
+++ karamba.h	(Arbeitskopie)
@@ -199,6 +199,7 @@
     bool repaintInProgress;
     //bool reloading;
     bool want_right_button;
+    bool want_meter_wheel_event;
 
     NETWinInfo* info;
     bool onTop;
@@ -290,6 +291,8 @@
      */
     void setWantRightButton(bool yesno) { want_right_button = yesno; }
 
+    void setWantMeterWheelEvent(bool yesno) { want_meter_wheel_event = yesno; }
+
     /**
      * can be used to fire up the karamba management popup menu
      */
Index: misc_python.cpp
===================================================================
--- misc_python.cpp	(Revision 638305)
+++ misc_python.cpp	(Arbeitskopie)
@@ -807,7 +807,7 @@
 PyObject* py_want_right_button(PyObject *, PyObject *args)
 {
   long widget, i;
-  if (!PyArg_ParseTuple(args, (char*)"ll:wantRightButton", &widget, &i))
+  if (!PyArg_ParseTuple(args, (char*)"ll:setWantRightButton", &widget, &i))
     return NULL;
   if (!checkKaramba(widget))
     return NULL;
@@ -815,7 +815,23 @@
   return Py_BuildValue((char*)"l", 1);
 }
 
+static void set_want_wheel_event(long widget, long yesno)
+{
+  karamba* currTheme = (karamba*)widget;
+  currTheme->setWantMeterWheelEvent(yesno);
+}
 
+PyObject* py_want_wheel_event(PyObject *, PyObject *args)
+{
+  long widget, i;
+  if (!PyArg_ParseTuple(args, (char*)"ll:setWantMeterWheelEvent", &widget, &i))
+    return NULL;
+  if (!checkKaramba(widget))
+    return NULL;
+  set_want_wheel_event(widget, i);
+  return Py_BuildValue((char*)"l", 1);
+}
+
 static void changeInterval(long widget, long interval)
 {
   karamba* currTheme = (karamba*)widget;
Index: karamba_python.cpp
===================================================================
--- karamba_python.cpp	(Revision 638305)
+++ karamba_python.cpp	(Arbeitskopie)
@@ -326,6 +326,8 @@
       (char*)"Get last updated time"},
     {(char*)"setWantRightButton", py_want_right_button, METH_VARARGS, 
       (char*)"Set to 1 to deactivate management popups"},
+    {(char*)"setWantMeterWheelEvent", py_want_wheel_event, METH_VARARGS, 
+      (char*)"Enables wheel events over meters."},
     {(char*)"managementPopup", py_management_popup, METH_VARARGS, 
       (char*)"Activates the Management Popup menu"},
 
Index: main.cpp
===================================================================
--- main.cpp	(Revision 638305)
+++ main.cpp	(Arbeitskopie)
@@ -42,7 +42,7 @@
 static const char *description =
     I18N_NOOP("A KDE Eye-candy Application");
 
-static const char *version = "0.41";
+static const char *version = "0.42";
 
 static KCmdLineOptions options[] =
 {
Index: misc_python.h
===================================================================
--- misc_python.h	(Revision 638305)
+++ misc_python.h	(Arbeitskopie)
@@ -534,10 +534,10 @@
 */
 PyObject* py_get_update_time(PyObject *self, PyObject *args);
 
-/** Misc/wantRightButton
+/** Misc/setWantRightButton
 *
 *  SYNOPSIS
-*    long wantRightButton(widget, want_receive_right_button)
+*    long setWantRightButton(widget, want_receive_right_button)
 *  DESCRIPTION
 *    There's a management menu for SuperKaramba themes which
 *    allows themes to be loaded, closed, moved to other
@@ -552,6 +552,24 @@
 */
 PyObject* py_want_right_button(PyObject *self, PyObject *args);
 
+/** Misc/setWantMeterWheelEvent
+*
+*  SYNOPSIS
+*    long setWantMeterWheelEvent(widget, want_receive_wheel_event)
+*  DESCRIPTION
+*    Enabling this allows themes to receive a wheel event when
+*    the wheel is turned over a meter.
+*    This function is available after version 0.42.
+*    This behaviour is default in SuperKaramba 0.50 and later,
+*    so this function will be not available after the 0.50 version.
+*  ARGUMENTS
+*    * long widget -- karamba
+*    * long want_receive_wheel_event -- whether the theme will receive mouse wheel events
+*  RETURN VALUE
+*    1 if successful
+*/
+PyObject* py_want_wheel_event(PyObject *, PyObject *args);
+
 /** Misc/managementPopup
 *
 *  SYNOPSIS


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic