Magellan Linux

Contents of /trunk/vnc/patches/vnc-scrollbars.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 637 - (show annotations) (download)
Tue Jun 3 20:32:55 2008 UTC (15 years, 11 months ago) by niro
File size: 2902 byte(s)
-added several new fixes from fedora

1 diff -up vnc-4_1_2-unixsrc/unix/tx/TXViewport.h.scrollbars vnc-4_1_2-unixsrc/unix/tx/TXViewport.h
2 --- vnc-4_1_2-unixsrc/unix/tx/TXViewport.h.scrollbars 2008-03-14 12:44:19.000000000 +0100
3 +++ vnc-4_1_2-unixsrc/unix/tx/TXViewport.h 2008-03-14 12:44:19.000000000 +0100
4 @@ -77,7 +77,8 @@ private:
5 int xOff, yOff;
6 rfb::Timer bumpScrollTimer;
7 bool bumpScroll;
8 - bool needScrollbars;
9 + bool needXScrollbar;
10 + bool needYScrollbar;
11 int bumpScrollX, bumpScrollY;
12 };
13 #endif
14 diff -up vnc-4_1_2-unixsrc/unix/tx/TXViewport.cxx.scrollbars vnc-4_1_2-unixsrc/unix/tx/TXViewport.cxx
15 --- vnc-4_1_2-unixsrc/unix/tx/TXViewport.cxx.scrollbars 2008-03-14 12:44:19.000000000 +0100
16 +++ vnc-4_1_2-unixsrc/unix/tx/TXViewport.cxx 2008-03-14 13:08:30.000000000 +0100
17 @@ -25,7 +25,8 @@
18 TXViewport::TXViewport(Display* dpy_, int w, int h, TXWindow* parent_)
19 : TXWindow(dpy_, w, h, parent_), child(0), hScrollbar(0),
20 vScrollbar(0), scrollbarSize(15), xOff(0), yOff(0), bumpScrollTimer(this),
21 - bumpScroll(false), needScrollbars(false), bumpScrollX(0), bumpScrollY(0)
22 + bumpScroll(false), needXScrollbar(false), needYScrollbar(false),
23 + bumpScrollX(0), bumpScrollY(0)
24 {
25 clipper = new TXWindow(dpy, width()-scrollbarSize, height()-scrollbarSize,
26 this);
27 @@ -132,13 +133,23 @@ bool TXViewport::handleTimeout(rfb::Time
28
29 void TXViewport::resizeNotify()
30 {
31 - needScrollbars = (!bumpScroll &&
32 - (width() < child->width() || height() < child->height()) &&
33 - (width() > scrollbarSize && height() > scrollbarSize));
34 - if (needScrollbars) {
35 + needXScrollbar = (!bumpScroll && width() < child->width() &&
36 + height() > scrollbarSize && width() > scrollbarSize);
37 + needYScrollbar = (!bumpScroll && height() < child->height() &&
38 + height() > scrollbarSize && width() > scrollbarSize);
39 +
40 + if (needXScrollbar && needYScrollbar) {
41 clipper->resize(width()-scrollbarSize, height()-scrollbarSize);
42 hScrollbar->map();
43 vScrollbar->map();
44 + } else if (needXScrollbar) {
45 + clipper->resize(width(), height()-scrollbarSize);
46 + hScrollbar->map();
47 + vScrollbar->unmap();
48 + } else if (needYScrollbar) {
49 + clipper->resize(width()-scrollbarSize, height());
50 + hScrollbar->unmap();
51 + vScrollbar->map();
52 } else {
53 clipper->resize(width(), height());
54 hScrollbar->unmap();
55 @@ -147,10 +158,13 @@ void TXViewport::resizeNotify()
56
57 setOffset(xOff, yOff);
58
59 - if (needScrollbars) {
60 + if (needXScrollbar) {
61 hScrollbar->move(0, height()-scrollbarSize);
62 hScrollbar->resize(width()-scrollbarSize, scrollbarSize);
63 hScrollbar->set(child->width(), -xOff, width()-scrollbarSize);
64 + }
65 +
66 + if (needYScrollbar) {
67 vScrollbar->move(width()-scrollbarSize, 0);
68 vScrollbar->resize(scrollbarSize, height()-scrollbarSize);
69 vScrollbar->set(child->height(), -yOff, height()-scrollbarSize);