Author: fireball
Date: Sun Jul 11 08:13:09 2010
New Revision: 47994
URL:
http://svn.reactos.org/svn/reactos?rev=47994&view=rev
Log:
- Bring in server-side clipboard implementation.
Added:
branches/arwinss/reactos/subsystems/win32/win32k/wine/clipboard.c
- copied, changed from r47984, vendor/wine/server/current/clipboard.c
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/include/user.h
branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h
branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild
branches/arwinss/reactos/subsystems/win32/win32k/wine/stubs.c
branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/user.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/user.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/user.h [iso-8859-1] Sun Jul
11 08:13:09 2010
@@ -84,7 +84,7 @@
/* clipboard functions */
-extern void cleanup_clipboard_thread( struct thread *thread );
+extern void cleanup_clipboard_thread( PTHREADINFO thread );
/* hook functions */
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h [iso-8859-1] Sun
Jul 11 08:13:09 2010
@@ -184,5 +184,7 @@
};
PVOID NTAPI ExReallocPool(PVOID OldPtr, ULONG NewSize, ULONG OldSize);
+time_t SystemTimeToUnixTime(const PLARGE_INTEGER SystemTime);
+
#endif
Modified: branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] Sun Jul 11
08:13:09 2010
@@ -138,6 +138,7 @@
<directory name="wine">
<file>atom.c</file>
<file>class.c</file>
+ <file>clipboard.c</file>
<file>directory.c</file>
<file>handle.c</file>
<file>hook.c</file>
Copied: branches/arwinss/reactos/subsystems/win32/win32k/wine/clipboard.c (from r47984,
vendor/wine/server/current/clipboard.c)
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- vendor/wine/server/current/clipboard.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/clipboard.c [iso-8859-1] Sun Jul
11 08:13:09 2010
@@ -18,29 +18,23 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "ntstatus.h"
-#define WIN32_NO_STATUS
+#include <win32k.h>
+
+#include <limits.h>
+
+#include "object.h"
#include "request.h"
-#include "object.h"
-#include "process.h"
#include "user.h"
-#include "winuser.h"
-#include "winternl.h"
+
+#define NDEBUG
+#include <debug.h>
struct clipboard
{
struct object obj; /* object header */
- struct thread *open_thread; /* thread id that has clipboard open */
+ PTHREADINFO open_thread; /* thread id that has clipboard open */
user_handle_t open_win; /* window that has clipboard open */
- struct thread *owner_thread; /* thread id that owns the clipboard */
+ PTHREADINFO owner_thread; /* thread id that owns the clipboard */
user_handle_t owner_win; /* window that owns the clipboard data */
user_handle_t viewer; /* first window in clipboard viewer list */
unsigned int seqno; /* clipboard change sequence number */
@@ -77,7 +71,7 @@
{
struct clipboard *clipboard = (struct clipboard *)obj;
- fprintf( stderr, "Clipboard open_thread=%p open_win=%08x owner_thread=%p
owner_win=%08x viewer=%08x seq=%u\n",
+ DPRINT1( "Clipboard open_thread=%p open_win=%08x owner_thread=%p owner_win=%08x
viewer=%08x seq=%u\n",
clipboard->open_thread, clipboard->open_win,
clipboard->owner_thread,
clipboard->owner_win, clipboard->viewer, clipboard->seqno );
}
@@ -86,7 +80,7 @@
static struct clipboard *get_process_clipboard(void)
{
struct clipboard *clipboard;
- struct winstation *winstation = get_process_winstation( current->process,
WINSTA_ACCESSCLIPBOARD );
+ struct winstation *winstation = get_process_winstation(
PsGetCurrentProcessWin32Process(), WINSTA_ACCESSCLIPBOARD );
if (!winstation) return NULL;
@@ -110,7 +104,7 @@
/* Called when thread terminates to allow release of clipboard */
-void cleanup_clipboard_thread(struct thread *thread)
+void cleanup_clipboard_thread(PTHREADINFO thread)
{
struct clipboard *clipboard;
struct winstation *winstation;
@@ -136,7 +130,7 @@
static int set_clipboard_window( struct clipboard *clipboard, user_handle_t win, int
clear )
{
- if (clipboard->open_thread && clipboard->open_thread != current)
+ if (clipboard->open_thread && clipboard->open_thread !=
PsGetCurrentThreadWin32Thread())
{
set_error(STATUS_WAS_LOCKED);
return 0;
@@ -144,7 +138,7 @@
else if (!clear)
{
clipboard->open_win = win;
- clipboard->open_thread = current;
+ clipboard->open_thread = PsGetCurrentThreadWin32Thread();
}
else
{
@@ -157,7 +151,7 @@
static int set_clipboard_owner( struct clipboard *clipboard, user_handle_t win, int clear
)
{
- if (clipboard->open_thread && clipboard->open_thread->process !=
current->process)
+ if (clipboard->open_thread && clipboard->open_thread->process !=
PsGetCurrentProcessWin32Process())
{
set_error(STATUS_WAS_LOCKED);
return 0;
@@ -165,7 +159,7 @@
else if (!clear)
{
clipboard->owner_win = win;
- clipboard->owner_thread = current;
+ clipboard->owner_thread = PsGetCurrentThreadWin32Thread();
}
else
{
@@ -178,7 +172,11 @@
static int get_seqno( struct clipboard *clipboard )
{
- time_t tm = time(NULL);
+ time_t tm;
+ LARGE_INTEGER SystemTime;
+
+ KeQuerySystemTime(&SystemTime);
+ tm = SystemTimeToUnixTime(&SystemTime);
if (!clipboard->owner_thread && (tm > (clipboard->seqno_timestamp +
MINUPDATELAPSE)))
{
@@ -192,6 +190,7 @@
DECL_HANDLER(set_clipboard_info)
{
struct clipboard *clipboard = get_process_clipboard();
+ PTHREADINFO current = PsGetCurrentThreadWin32Thread();
if (!clipboard) return;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/stubs.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/stubs.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/stubs.c [iso-8859-1] Sun Jul 11
08:13:09 2010
@@ -598,11 +598,6 @@
UNIMPLEMENTED;
}
-DECL_HANDLER(set_clipboard_info)
-{
- UNIMPLEMENTED;
-}
-
DECL_HANDLER(open_token)
{
UNIMPLEMENTED;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c [iso-8859-1] Sun Jul
11 08:13:09 2010
@@ -165,4 +165,17 @@
return NewPtr;
}
+#define DIFFTIME 0x19db1ded53e8000ULL
+
+time_t
+SystemTimeToUnixTime(const PLARGE_INTEGER SystemTime)
+{
+ ULARGE_INTEGER ULargeInt;
+
+ ULargeInt.QuadPart = SystemTime->QuadPart;
+ ULargeInt.QuadPart -= DIFFTIME;
+
+ return ULargeInt.QuadPart / 10000000;
+}
+
/* EOF */