|
1 ## Patch originally from Fedora - Revision 1.1 of: |
|
2 http://cvs.fedoraproject.org/viewvc/rpms/vnc/devel/vnc-selections.patch |
|
3 with paths adjusted to match sources in tarball before files are moved |
|
4 |
|
5 diff -up vnc-4_1_2-unixsrc/unix/xc/programs/Xserver/vnc/vncExtInit.cc.selections vnc-4_1_2-unixsrc/unix/xc/programs/Xserver/vnc/vncExtInit.cc |
|
6 --- vnc-4_1_2-unixsrc/unix/xc/programs/Xserver/vnc/vncExtInit.cc.selections 2008-03-10 15:34:24.000000000 +0100 |
|
7 +++ vnc-4_1_2-unixsrc/unix/xc/programs/Xserver/vnc/vncExtInit.cc 2008-03-11 10:55:44.000000000 +0100 |
|
8 @@ -62,11 +62,9 @@ extern "C" { |
|
9 static void SendSelectionChangeEvent(Atom selection); |
|
10 static int ProcVncExtDispatch(ClientPtr client); |
|
11 static int SProcVncExtDispatch(ClientPtr client); |
|
12 + static void vncSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args); |
|
13 |
|
14 extern char *display; |
|
15 - |
|
16 - extern Selection *CurrentSelections; |
|
17 - extern int NumCurrentSelections; |
|
18 } |
|
19 |
|
20 using namespace rfb; |
|
21 @@ -99,7 +97,6 @@ struct VncInputSelect { |
|
22 VncInputSelect* next; |
|
23 }; |
|
24 |
|
25 -static int nPrevSelections = 0; |
|
26 static TimeStamp* prevSelectionTimes = 0; |
|
27 |
|
28 static int vncErrorBase = 0; |
|
29 @@ -147,6 +144,10 @@ void vncExtensionInit() |
|
30 FatalError("AddCallback failed\n"); |
|
31 } |
|
32 |
|
33 + if (!AddCallback(&SelectionCallback, vncSelectionCallback, 0)) { |
|
34 + FatalError("Add selection callback failed\n"); |
|
35 + } |
|
36 + |
|
37 try { |
|
38 if (!initialised) { |
|
39 rfb::initStdIOLoggers(); |
|
40 @@ -212,6 +213,14 @@ static void vncResetProc(ExtensionEntry* |
|
41 { |
|
42 } |
|
43 |
|
44 +static void vncSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args) |
|
45 +{ |
|
46 + SelectionInfoRec *info = (SelectionInfoRec *) args; |
|
47 + Selection *selection = info->selection; |
|
48 + |
|
49 + SendSelectionChangeEvent(selection->selection); |
|
50 +} |
|
51 + |
|
52 // |
|
53 // vncBlockHandler - called just before the X server goes into select(). Call |
|
54 // on to the block handler for each desktop. Then check whether any of the |
|
55 @@ -227,27 +236,6 @@ static void vncBlockHandler(pointer data |
|
56 desktop[scr]->blockHandler(fds); |
|
57 } |
|
58 } |
|
59 - |
|
60 - if (nPrevSelections != NumCurrentSelections) { |
|
61 - prevSelectionTimes |
|
62 - = (TimeStamp*)xnfrealloc(prevSelectionTimes, |
|
63 - NumCurrentSelections * sizeof(TimeStamp)); |
|
64 - for (int i = nPrevSelections; i < NumCurrentSelections; i++) { |
|
65 - prevSelectionTimes[i].months = 0; |
|
66 - prevSelectionTimes[i].milliseconds = 0; |
|
67 - } |
|
68 - nPrevSelections = NumCurrentSelections; |
|
69 - } |
|
70 - for (int i = 0; i < NumCurrentSelections; i++) { |
|
71 - if (CurrentSelections[i].lastTimeChanged.months |
|
72 - != prevSelectionTimes[i].months || |
|
73 - CurrentSelections[i].lastTimeChanged.milliseconds |
|
74 - != prevSelectionTimes[i].milliseconds) |
|
75 - { |
|
76 - SendSelectionChangeEvent(CurrentSelections[i].selection); |
|
77 - prevSelectionTimes[i] = CurrentSelections[i].lastTimeChanged; |
|
78 - } |
|
79 - } |
|
80 } |
|
81 |
|
82 static void vncWakeupHandler(pointer data, int nfds, pointer readmask) |