TDE graphics utilities
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

615 lines
19KB

  1. Eliminates flicker when moving document resize lines / dragging resize
  2. handles by:
  3. 1. Not erasing areas that will be subsequently painted over with resize
  4. lines.
  5. 2. Erasing the old areas and painting the new ones atomicly by using
  6. clever NOT'ing of pixels.
  7. Additionally, recover the resize lines after a window pops up momentarily
  8. over KolourPaint (kpViewScrollableContainer::windowActivationChange()).
  9. Critical bugs with this code and scrollbars:
  10. 1. Drag scrolling leaves trails of resize lines.
  11. 2. Moving the mouse cursor above the start of the document does not result
  12. in a resize line at document y = 1.
  13. Because I'm still debugging, there are a few hacks in the code such as
  14. "m_resizeLinesDontPaintClever".
  15. Index: kpviewscrollablecontainer.cpp
  16. ===================================================================
  17. RCS file: /home/kde/tdegraphics/kolourpaint/kpviewscrollablecontainer.cpp,v
  18. retrieving revision 1.7
  19. diff -u -p -r1.7 kpviewscrollablecontainer.cpp
  20. --- kpviewscrollablecontainer.cpp 29 Jul 2004 12:47:15 -0000 1.7
  21. +++ kpviewscrollablecontainer.cpp 30 Jul 2004 11:37:20 -0000
  22. @@ -1,4 +1,4 @@
  23. -
  24. +static bool inScroll = false;
  25. /*
  26. Copyright (c) 2003-2004 Clarence Dang <dang@kde.org>
  27. All rights reserved.
  28. @@ -33,6 +33,7 @@
  29. #include <qpainter.h>
  30. #include <qpen.h>
  31. #include <qpixmap.h>
  32. +#include <qregion.h>
  33. #include <qtimer.h>
  34. #include <kdebug.h>
  35. @@ -240,7 +241,7 @@ void kpGrip::mousePressEvent (QMouseEven
  36. m_startPoint = e->pos ();
  37. m_currentPoint = e->pos ();
  38. emit beganDraw ();
  39. - grabKeyboard ();
  40. + //grabKeyboard (); HACK
  41. setUserMessage (i18n ("Resize Image: Right click to cancel."));
  42. setCursor (cursorForType (m_type));
  43. @@ -387,6 +388,7 @@ kpViewScrollableContainer::kpViewScrolla
  44. m_scrollTimerRunOnce (false),
  45. m_resizeRoundedLastViewX (-1), m_resizeRoundedLastViewY (-1),
  46. m_resizeRoundedLastViewDX (0), m_resizeRoundedLastViewDY (0),
  47. + m_resizeLinesDontPaintClever (0),
  48. m_haveMovedFromOriginalDocSize (false)
  49. {
  50. @@ -561,6 +563,18 @@ QRect kpViewScrollableContainer::bottomR
  51. m_resizeRoundedLastViewY + bottomResizeLineWidth () - 1));
  52. }
  53. +// protected
  54. +QRegion kpViewScrollableContainer::resizeLinesRegion () const
  55. +{
  56. + QRegion ret;
  57. +
  58. + ret += rightResizeLineRect ();
  59. + ret += bottomResizeLineRect ();
  60. + ret += bottomRightResizeLineRect ();
  61. +
  62. + return ret;
  63. +}
  64. +
  65. // TODO: are these 2 correct? Remember that viewport()->x() == 1, viewport()->y() == 1
  66. @@ -581,6 +595,17 @@ QRect kpViewScrollableContainer::mapView
  67. return ret;
  68. }
  69. +// protected
  70. +QRegion kpViewScrollableContainer::mapViewToViewport (const QRegion &viewRegion)
  71. +{
  72. + if (viewRegion.isEmpty ())
  73. + return viewRegion;
  74. +
  75. + QRegion ret = viewRegion;
  76. + ret.translate (-contentsX (), -contentsY ());
  77. + return ret;
  78. +}
  79. +
  80. // protected
  81. QRect kpViewScrollableContainer::mapViewportToGlobal (const QRect &viewportRect)
  82. @@ -589,89 +614,108 @@ QRect kpViewScrollableContainer::mapView
  83. }
  84. // protected
  85. +QRegion kpViewScrollableContainer::mapViewportToGlobal (const QRegion &viewportRegion)
  86. +{
  87. + return kpWidgetMapper::toGlobal (viewport (), viewportRegion);
  88. +}
  89. +
  90. +
  91. +// protected
  92. QRect kpViewScrollableContainer::mapViewToGlobal (const QRect &viewRect)
  93. {
  94. return mapViewportToGlobal (mapViewToViewport (viewRect));
  95. }
  96. +// protected
  97. +QRegion kpViewScrollableContainer::mapViewToGlobal (const QRegion &viewRegion)
  98. +{
  99. + return mapViewportToGlobal (mapViewToViewport (viewRegion));
  100. +}
  101. +
  102. // protected
  103. -void kpViewScrollableContainer::repaintWidgetAtResizeLineViewRect (
  104. - QWidget *widget, const QRect &resizeLineViewRect)
  105. +void kpViewScrollableContainer::repaintWidgetRegion (
  106. + QWidget *widget,
  107. + const QRegion &viewRegion)
  108. {
  109. - const QRect resizeLineGlobalRect = mapViewToGlobal (resizeLineViewRect);
  110. + const QRegion globalRegion = mapViewToGlobal (viewRegion);
  111. +
  112. const QRect widgetGlobalRect = kpWidgetMapper::toGlobal (widget,
  113. widget->rect ());
  114. - const QRect redrawGlobalRect =
  115. - resizeLineGlobalRect.intersect (widgetGlobalRect);
  116. - const QRect redrawWidgetRect =
  117. - kpWidgetMapper::fromGlobal (widget, redrawGlobalRect);
  118. + const QRegion redrawGlobalRegion =
  119. + globalRegion.intersect (widgetGlobalRect);
  120. + const QRegion redrawWidgetRegion =
  121. + kpWidgetMapper::fromGlobal (widget, redrawGlobalRegion);
  122. - if (redrawWidgetRect.isValid ())
  123. +
  124. + if (!redrawWidgetRegion.isEmpty ())
  125. {
  126. // TODO: should be "!widget->testWFlags (Qt::WRepaintNoErase)"
  127. // but for some reason, doesn't work for viewport().
  128. const bool erase = !dynamic_cast <kpView *> (widget);
  129. - widget->repaint (redrawWidgetRect, erase);
  130. + widget->repaint (redrawWidgetRegion, erase);
  131. }
  132. }
  133. // protected
  134. -void kpViewScrollableContainer::repaintWidgetAtResizeLines (QWidget *widget)
  135. +void kpViewScrollableContainer::eraseResizeLines (const QRegion &viewRegion)
  136. {
  137. - repaintWidgetAtResizeLineViewRect (widget, rightResizeLineRect ());
  138. - repaintWidgetAtResizeLineViewRect (widget, bottomResizeLineRect ());
  139. - repaintWidgetAtResizeLineViewRect (widget, bottomRightResizeLineRect ());
  140. -}
  141. + if (viewRegion.isEmpty ())
  142. + return;
  143. -// protected
  144. -void kpViewScrollableContainer::eraseResizeLines ()
  145. -{
  146. - if (m_resizeRoundedLastViewX >= 0 && m_resizeRoundedLastViewY >= 0)
  147. - {
  148. - repaintWidgetAtResizeLines (viewport ());
  149. - repaintWidgetAtResizeLines (m_view);
  150. - repaintWidgetAtResizeLines (m_bottomGrip);
  151. - repaintWidgetAtResizeLines (m_rightGrip);
  152. - repaintWidgetAtResizeLines (m_bottomRightGrip);
  153. - }
  154. + repaintWidgetRegion (viewport (), viewRegion);
  155. + repaintWidgetRegion (m_view, viewRegion);
  156. +
  157. + repaintWidgetRegion (m_bottomGrip, viewRegion);
  158. + repaintWidgetRegion (m_rightGrip, viewRegion);
  159. + repaintWidgetRegion (m_bottomRightGrip, viewRegion);
  160. }
  161. // protected
  162. -void kpViewScrollableContainer::drawResizeLines ()
  163. +void kpViewScrollableContainer::drawResizeLines (const QRegion &viewRegion)
  164. {
  165. #if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER
  166. - kdDebug () << "kpViewScrollableContainer::drawResizeLines()"
  167. + kdDebug () << "kpViewScrollableContainer::drawResizeLines("
  168. + << viewRegion <<")"
  169. << " lastViewX=" << m_resizeRoundedLastViewX
  170. << " lastViewY=" << m_resizeRoundedLastViewY
  171. << endl;
  172. #endif
  173. + if (viewRegion.isEmpty ())
  174. + return;
  175. +
  176. QPainter p (viewport (), true/*unclipped*/);
  177. p.setRasterOp (Qt::NotROP);
  178. - const QRect rightRect = rightResizeLineRect ();
  179. - if (rightRect.isValid ())
  180. - p.fillRect (mapViewToViewport (rightRect), Qt::white);
  181. -
  182. - const QRect bottomRect = bottomResizeLineRect ();
  183. - if (bottomRect.isValid ())
  184. - p.fillRect (mapViewToViewport (bottomRect), Qt::white);
  185. -
  186. - const QRect bottomRightRect = bottomRightResizeLineRect ();
  187. - if (bottomRightRect.isValid ())
  188. - p.fillRect (mapViewToViewport (bottomRightRect), Qt::white);
  189. + const QMemArray <QRect> rects = mapViewToViewport (viewRegion).rects ();
  190. + for (QMemArray <QRect>::ConstIterator it = rects.begin ();
  191. + it != rects.end ();
  192. + it++)
  193. + {
  194. + p.fillRect (*it, Qt::white);
  195. + }
  196. p.end ();
  197. }
  198. +template <typename T>
  199. +static inline void swap (T &a, T &b)
  200. +{
  201. + T temp = a;
  202. +
  203. + a = b;
  204. + b = temp;
  205. +}
  206. +
  207. +
  208. // protected
  209. void kpViewScrollableContainer::updateResizeLines (int viewX, int viewY,
  210. int viewDX, int viewDY)
  211. @@ -686,36 +730,71 @@ void kpViewScrollableContainer::updateRe
  212. << endl;
  213. #endif
  214. - eraseResizeLines ();
  215. -
  216. + int newResizeRoundedLastViewX = -1,
  217. + newResizeRoundedLastViewY = -1;
  218. + int newResizeRoundedLastViewDX = 0,
  219. + newResizeRoundedLastViewDY = 0;
  220. if (viewX >= 0 && viewY >= 0)
  221. {
  222. - m_resizeRoundedLastViewX = m_view->zoomDocToViewX (m_view->zoomViewToDocX (viewX));
  223. - m_resizeRoundedLastViewY = m_view->zoomDocToViewY (m_view->zoomViewToDocY (viewY));
  224. + newResizeRoundedLastViewX = m_view->zoomDocToViewX (m_view->zoomViewToDocX (viewX));
  225. + newResizeRoundedLastViewY = m_view->zoomDocToViewY (m_view->zoomViewToDocY (viewY));
  226. - m_resizeRoundedLastViewDX = viewDX;
  227. - m_resizeRoundedLastViewDY = viewDY;
  228. + newResizeRoundedLastViewDX = viewDX;
  229. + newResizeRoundedLastViewDY = viewDY;
  230. }
  231. - else
  232. - {
  233. - m_resizeRoundedLastViewX = -1;
  234. - m_resizeRoundedLastViewY = -1;
  235. - m_resizeRoundedLastViewDX = 0;
  236. - m_resizeRoundedLastViewDY = 0;
  237. - }
  238. - // TODO: This is suboptimal since if another window pops up on top of
  239. - // KolourPaint then disappears, the lines are not redrawn
  240. - // (although this doesn't happen very frequently since we grab the
  241. - // keyboard and mouse when resizing):
  242. - //
  243. - // e.g. sleep 5 && gedit & sleep 10 && killall gedit
  244. + QRegion oldLinesRegion = resizeLinesRegion ();
  245. +#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER
  246. + kdDebug () << "\toldLinesRegion=" << oldLinesRegion << endl;
  247. +#endif
  248. +
  249. +
  250. +// (macro instead of writing out code to permit experimentation)
  251. +#define SWAP_LAST_VIEW_STATS() \
  252. +{ \
  253. + swap (m_resizeRoundedLastViewX, newResizeRoundedLastViewX); \
  254. + swap (m_resizeRoundedLastViewY, newResizeRoundedLastViewY); \
  255. + \
  256. + swap (m_resizeRoundedLastViewDX, newResizeRoundedLastViewDX); \
  257. + swap (m_resizeRoundedLastViewDY, newResizeRoundedLastViewDY); \
  258. +}
  259. + SWAP_LAST_VIEW_STATS ();
  260. +#undef SWAP_LAST_VIEW_STATS
  261. +
  262. +
  263. + QRegion newLinesRegion = resizeLinesRegion ();
  264. +#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER
  265. + kdDebug () << "\tnewLinesRegion=" << newLinesRegion << endl;
  266. +#endif
  267. +
  268. +
  269. + // TODO: This is suboptimal - we will get redraw errors sooner or later.
  270. + // But I've tried hard to avoid them (e.g. windowActivationChange()).
  271. //
  272. // Should be done in the paintEvent's of every child of the
  273. // scrollview.
  274. - drawResizeLines ();
  275. +
  276. + if (m_resizeLinesDontPaintClever)
  277. + {
  278. + // (drawResizeLines() NOT's the pixels - so we can erase old and draw
  279. + // new at the same time)
  280. + drawResizeLines (newLinesRegion.eor (oldLinesRegion));
  281. + #if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER
  282. + kdDebug () << "\tNOTRregion="
  283. + << newLinesRegion.eor (oldLinesRegion) << endl;
  284. + #endif
  285. + }
  286. + else
  287. + {
  288. + eraseResizeLines (oldLinesRegion);
  289. + drawResizeLines (newLinesRegion);
  290. + #if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER
  291. + kdDebug () << "\tnot erasing old lines; NOTRregion="
  292. + << newLinesRegion << endl;
  293. + #endif
  294. + }
  295. }
  296. @@ -729,6 +808,8 @@ void kpViewScrollableContainer::slotGrip
  297. m_haveMovedFromOriginalDocSize = false;
  298. + m_resizeLinesDontPaintClever = true;
  299. +
  300. updateResizeLines (m_view->width (), m_view->height (),
  301. 0/*viewDX*/, 0/*viewDY*/);
  302. @@ -750,12 +831,28 @@ void kpViewScrollableContainer::slotGrip
  303. m_haveMovedFromOriginalDocSize = true;
  304. +#if 0
  305. + if (inScroll != !m_resizeLinesNeedErase)
  306. + {
  307. + kdError () << "slotGripContDraw EXCEPTION 0: inScroll=" << inScroll << endl;
  308. + memset (0, 42, 1048576);
  309. + }
  310. +#endif
  311. +
  312. updateResizeLines (QMAX (1, TQMAX (m_view->width () + viewDX, m_view->zoomDocToViewX (1))),
  313. QMAX (1, TQMAX (m_view->height () + viewDY, m_view->zoomDocToViewY (1))),
  314. viewDX, viewDY);
  315. emit continuedDocResize (newDocSize ());
  316. +#if 0
  317. + if (!m_resizeLinesNeedErase)
  318. + {
  319. + kdError () << "slotGripContDraw EXCEPTION 1" << endl;
  320. + memset (0, 42, 1048576);
  321. + }
  322. +#endif
  323. +
  324. beginDragScroll (QPoint (), QPoint (), m_view->zoomLevelX ());
  325. }
  326. @@ -859,8 +956,19 @@ void kpViewScrollableContainer::slotCont
  327. << x << "," << y << ")" << endl;
  328. #endif
  329. + m_resizeLinesDontPaintClever++;
  330. +
  331. + if (inScroll && 0)
  332. + {
  333. + kdError () << "slotContentsMovING EXCEPTION" << endl;
  334. + memset (0, 42, 1048576);
  335. + }
  336. +
  337. + inScroll = true;
  338. // Reduce flicker - don't let QScrollView scroll to-be-erased lines
  339. - eraseResizeLines ();
  340. + //eraseResizeLines (resizeLinesRegion ());
  341. + //m_resizeLinesNeedErase = false;
  342. +
  343. QTimer::singleShot (0, this, SLOT (slotContentsMoved ()));
  344. }
  345. @@ -874,9 +982,27 @@ void kpViewScrollableContainer::slotCont
  346. << " grip=" << grip << endl;
  347. #endif
  348. if (!grip)
  349. + {
  350. + inScroll = false;
  351. return;
  352. + }
  353. + if (!inScroll && 0)
  354. + {
  355. + kdError () << "slotContentsMoved EXCEPTION" << endl;
  356. + memset (0, 42, 1048576);
  357. + }
  358. grip->mouseMovedTo (grip->mapFromGlobal (QCursor::pos ()));
  359. +#if 0
  360. + if (!m_resizeLinesNeedErase)
  361. + {
  362. + kdError () << "slotContentsMoved EXCEPTION 2" << endl;
  363. + memset (0, 42, 1048576);
  364. + }
  365. +#endif
  366. + inScroll = false;
  367. +
  368. + m_resizeLinesDontPaintClever--;
  369. }
  370. @@ -1191,7 +1317,7 @@ bool kpViewScrollableContainer::eventFil
  371. // protected virtual [base QScrollView]
  372. void kpViewScrollableContainer::viewportPaintEvent (QPaintEvent *e)
  373. {
  374. -#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER
  375. +#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER && 0
  376. kdDebug () << "kpViewScrollableContainer::viewportPaintEvent("
  377. << e->rect ()
  378. << ")" << endl;
  379. @@ -1213,4 +1339,42 @@ void kpViewScrollableContainer::paintEve
  380. }
  381. +// protected slot
  382. +void kpViewScrollableContainer::windowActivationChanged ()
  383. +{
  384. + if (isActiveWindow () &&
  385. + m_resizeRoundedLastViewX >= 0 && m_resizeRoundedLastViewY >= 0)
  386. + {
  387. + // We were obscured by a window that popped up monmentarily and
  388. + // this clobbered the resize lines (since the scrollView's child
  389. + // widgets don't draw them). This doesn't happen very frequently
  390. + // since we grab the keyboard and mouse when resizing but:
  391. + //
  392. + // e.g. sleep 5 && gedit & sleep 10 && killall gedit
  393. + //
  394. +
  395. + // Repaint child widgets at the resize lines to make sure any
  396. + // remains of the resize lines are gone.
  397. + eraseResizeLines (resizeLinesRegion ());
  398. +
  399. + // Draw the resize lines by NOT-ing the child widget pixels.
  400. + drawResizeLines (resizeLinesRegion ());
  401. + }
  402. +}
  403. +
  404. +// protected virtual [base QWidget]
  405. +void kpViewScrollableContainer::windowActivationChange (bool wasActive)
  406. +{
  407. +#if DEBUG_KP_VIEW_SCROLLABLE_CONTAINER && 1
  408. + kdDebug () << "kpViewScrollableContainer::windowActivationChange("
  409. + << wasActive << ")" << endl;
  410. +#endif
  411. +
  412. + QScrollView::windowActivationChange (wasActive);
  413. +
  414. + // Wait for m_view to update
  415. + QTimer::singleShot (0, this, SLOT (windowActivationChanged ()));
  416. +}
  417. +
  418. +
  419. #include <kpviewscrollablecontainer.moc>
  420. Index: kpviewscrollablecontainer.h
  421. ===================================================================
  422. RCS file: /home/kde/tdegraphics/kolourpaint/kpviewscrollablecontainer.h,v
  423. retrieving revision 1.3
  424. diff -u -p -r1.3 kpviewscrollablecontainer.h
  425. --- kpviewscrollablecontainer.h 19 Jul 2004 05:00:47 -0000 1.3
  426. +++ kpviewscrollablecontainer.h 30 Jul 2004 11:37:21 -0000
  427. @@ -31,6 +31,7 @@
  428. #include <qpoint.h>
  429. +#include <qregion.h>
  430. #include <qscrollview.h>
  431. #include <qsize.h>
  432. @@ -147,19 +148,23 @@ protected:
  433. QRect bottomResizeLineRect () const;
  434. QRect rightResizeLineRect () const;
  435. QRect bottomRightResizeLineRect () const;
  436. + QRegion resizeLinesRegion () const;
  437. QPoint mapViewToViewport (const QPoint &viewPoint);
  438. QRect mapViewToViewport (const QRect &viewRect);
  439. + QRegion mapViewToViewport (const QRegion &viewRegion);
  440. QRect mapViewportToGlobal (const QRect &viewportRect);
  441. + QRegion mapViewportToGlobal (const QRegion &viewportRegion);
  442. +
  443. QRect mapViewToGlobal (const QRect &viewRect);
  444. + QRegion mapViewToGlobal (const QRegion &viewRegion);
  445. - void repaintWidgetAtResizeLineViewRect (QWidget *widget,
  446. - const QRect &resizeLineViewRect);
  447. - void repaintWidgetAtResizeLines (QWidget *widget);
  448. - void eraseResizeLines ();
  449. + void repaintWidgetRegion (QWidget *widget,
  450. + const QRegion &viewRegion);
  451. + void eraseResizeLines (const QRegion &viewRegion);
  452. - void drawResizeLines ();
  453. + void drawResizeLines (const QRegion &viewRegion);
  454. void updateResizeLines (int viewX, int viewY,
  455. int viewDX, int viewDY);
  456. @@ -213,6 +218,12 @@ protected:
  457. virtual void viewportPaintEvent (QPaintEvent *e);
  458. virtual void paintEvent (QPaintEvent *e);
  459. +protected Q_SLOTS:
  460. + void windowActivationChanged ();
  461. +protected:
  462. + virtual void windowActivationChange (bool wasActive);
  463. +
  464. +
  465. protected:
  466. kpMainWindow *m_mainWindow;
  467. kpView *m_view;
  468. @@ -223,6 +234,7 @@ protected:
  469. bool m_scrollTimerRunOnce;
  470. int m_resizeRoundedLastViewX, m_resizeRoundedLastViewY;
  471. int m_resizeRoundedLastViewDX, m_resizeRoundedLastViewDY;
  472. + int m_resizeLinesDontPaintClever;
  473. bool m_haveMovedFromOriginalDocSize;
  474. QString m_gripStatusMessage;
  475. };
  476. Index: kpwidgetmapper.cpp
  477. ===================================================================
  478. RCS file: /home/kde/tdegraphics/kolourpaint/kpwidgetmapper.cpp,v
  479. retrieving revision 1.1
  480. diff -u -p -r1.1 kpwidgetmapper.cpp
  481. --- kpwidgetmapper.cpp 10 Jul 2004 11:38:09 -0000 1.1
  482. +++ kpwidgetmapper.cpp 30 Jul 2004 11:37:21 -0000
  483. @@ -30,6 +30,7 @@
  484. #include <qpoint.h>
  485. #include <qrect.h>
  486. +#include <qregion.h>
  487. #include <qwidget.h>
  488. @@ -54,6 +55,17 @@ QRect fromGlobal (const QWidget *widget,
  489. return QRect (topLeft.x (), topLeft.y (), rect.width (), rect.height ());
  490. }
  491. +QRegion fromGlobal (const QWidget *widget, const QRegion &region)
  492. +{
  493. + if (!widget || region.isEmpty ())
  494. + return region;
  495. +
  496. + const QPoint widgetGlobalTopLeft = toGlobal (widget, QPoint (0, 0));
  497. + QRegion ret = region;
  498. + ret.translate (-widgetGlobalTopLeft.x (), -widgetGlobalTopLeft.y ());
  499. + return ret;
  500. +}
  501. +
  502. QPoint toGlobal (const QWidget *widget, const QPoint &point)
  503. {
  504. @@ -72,5 +84,16 @@ QRect toGlobal (const QWidget *widget, c
  505. return QRect (topLeft.x (), topLeft.y (), rect.width (), rect.height ());
  506. }
  507. +QRegion toGlobal (const QWidget *widget, const QRegion &region)
  508. +{
  509. + if (!widget || region.isEmpty ())
  510. + return region;
  511. +
  512. + const QPoint widgetGlobalTopLeft = toGlobal (widget, QPoint (0, 0));
  513. + QRegion ret = region;
  514. + ret.translate (widgetGlobalTopLeft.x (), widgetGlobalTopLeft.y ());
  515. + return ret;
  516. +}
  517. +
  518. } // namespace kpWidgetMapper {
  519. Index: kpwidgetmapper.h
  520. ===================================================================
  521. RCS file: /home/kde/tdegraphics/kolourpaint/kpwidgetmapper.h,v
  522. retrieving revision 1.1
  523. diff -u -p -r1.1 kpwidgetmapper.h
  524. --- kpwidgetmapper.h 10 Jul 2004 11:38:09 -0000 1.1
  525. +++ kpwidgetmapper.h 30 Jul 2004 11:37:21 -0000
  526. @@ -32,15 +32,18 @@
  527. class QWidget;
  528. class QPoint;
  529. class QRect;
  530. +class QRegion;
  531. namespace kpWidgetMapper
  532. {
  533. QPoint fromGlobal (const QWidget *widget, const QPoint &point);
  534. QRect fromGlobal (const QWidget *widget, const QRect &rect);
  535. + QRegion fromGlobal (const QWidget *widget, const QRegion &region);
  536. QPoint toGlobal (const QWidget *widget, const QPoint &point);
  537. QRect toGlobal (const QWidget *widget, const QRect &rect);
  538. + QRegion toGlobal (const QWidget *widget, const QRegion &region);
  539. }