[5/6]server: open_input_desktop server (try 2)

shanmukha sainath addepalli sainath.addepalli at gmail.com
Sat Dec 12 05:06:21 CST 2009


Hi,

       Difference from previous patch:
             1. Code written in server request of close_desktop has
been removed.

      In this patch, we will open a handle to the active desktop with
the specified access rights.

     While creating winstation,  we will initialise active_desktop of
the winstation to NULL. active _desktop value will be set when
creating first desktop of winstation or while switching to another
desktop.

-- 
Regards
Sainath A
-------------- next part --------------
From 5416cac8eac0faeacc14338260d9e4c49152ee19 Mon Sep 17 00:00:00 2001
From: Sainath Addepalli <sainath.addepalli at gmail.com>
Date: Fri, 11 Dec 2009 19:33:59 +0530
Subject: OpenInputDesktop Server Declaration

---
 server/protocol.def |   10 ++++++++++
 server/winstation.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/server/protocol.def b/server/protocol.def
index 8c7d303..daee57f 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -2568,6 +2568,16 @@ enum message_type
 @END
 
 
+/* Open Input Desktop */
+ at REQ(open_input_desktop)
+    unsigned int flags;           /* desktop flags */
+    unsigned int access;          /* wanted access rights */
+    unsigned int attributes;      /* object attributes */
+ at REPLY
+    obj_handle_t handle;          /* handle to the desktop */
+ at END
+
+
 /* Get/set information about a user object (window station or desktop) */
 @REQ(set_user_object_info)
     obj_handle_t handle;          /* handle to the object */
diff --git a/server/winstation.c b/server/winstation.c
index 7ddc277..bdc038b 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -121,6 +121,7 @@ static struct winstation *create_winstation( const struct unicode_str *name, uns
             winstation->flags = flags;
             winstation->clipboard = NULL;
             winstation->atom_table = NULL;
+            winstation->active_desktop = NULL;
             list_add_tail( &winstation_list, &winstation->entry );
             list_init( &winstation->desktops );
         }
@@ -498,6 +499,8 @@ DECL_HANDLER(create_desktop)
         if ((desktop = create_desktop( &name, req->attributes, req->flags, winstation )))
         {
             reply->handle = alloc_handle( current->process, desktop, req->access, req->attributes );
+            if (winstation->active_desktop == NULL)
+                winstation->active_desktop = desktop;   /* This is the first desktop of the winstation */
             release_object( desktop );
         }
         release_object( winstation );
@@ -534,6 +537,33 @@ DECL_HANDLER(open_desktop)
 }
 
 
+/* open a handle to input desktop */
+DECL_HANDLER(open_input_desktop)
+{
+    struct winstation *winstation = NULL;
+    struct desktop *desktop;
+    struct object *obj;
+
+    winstation = get_process_winstation( current->process, 0 );
+    if (winstation)
+    {
+        desktop = winstation->active_desktop;
+        if (!desktop)
+        {
+            release_object( winstation );
+            return;
+        }
+        obj = &(desktop->obj);
+        if (obj->ops != &desktop_ops)
+            set_error( STATUS_OBJECT_TYPE_MISMATCH );
+        else
+            reply->handle = alloc_handle( current->process, obj, req->access, req->attributes );
+
+        release_object( winstation );
+    }
+}
+
+
 /* close a desktop */
 DECL_HANDLER(close_desktop)
 {
-- 
1.6.0.4


More information about the wine-patches mailing list