Jeremy White : sane.ds: Add support for CAP_UICONTROLLABLE.

Alexandre Julliard julliard at winehq.org
Tue Feb 10 07:45:31 CST 2009


Module: wine
Branch: master
Commit: 6320266e58de650bb0effc018acb8dbb19237394
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6320266e58de650bb0effc018acb8dbb19237394

Author: Jeremy White <jwhite at winehq.org>
Date:   Mon Feb  9 13:01:39 2009 -0600

sane.ds: Add support for CAP_UICONTROLLABLE.

---

 dlls/sane.ds/capability.c |   27 ++++++++++++++++++++++++++-
 dlls/twain_32/tests/dsm.c |    9 +++++----
 2 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/dlls/sane.ds/capability.c b/dlls/sane.ds/capability.c
index 84d6b40..45c3f88 100644
--- a/dlls/sane.ds/capability.c
+++ b/dlls/sane.ds/capability.c
@@ -125,7 +125,7 @@ static TW_UINT16 msg_get_enum(pTW_CAPABILITY pCapability, const TW_UINT32 *value
 static TW_UINT16 TWAIN_GetSupportedCaps(pTW_CAPABILITY pCapability)
 {
     TW_ARRAY *a;
-    static const UINT16 supported_caps[] = { CAP_SUPPORTEDCAPS, CAP_XFERCOUNT,
+    static const UINT16 supported_caps[] = { CAP_SUPPORTEDCAPS, CAP_XFERCOUNT, CAP_UICONTROLLABLE,
                     ICAP_XFERMECH, ICAP_PIXELTYPE };
 
     pCapability->hContainer = GlobalAlloc (0, FIELD_OFFSET( TW_ARRAY, ItemList[sizeof(supported_caps)] ));
@@ -282,6 +282,27 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio
     return twCC;
 }
 
+/* CAP_UICONTROLLABLE */
+static TW_UINT16 SANE_CAPUiControllable(pTW_CAPABILITY pCapability, TW_UINT16 action)
+{
+    TW_UINT16 twCC = TWCC_BADCAP;
+
+    TRACE("CAP_UICONTROLLABLE\n");
+
+    switch (action)
+    {
+        case MSG_QUERYSUPPORT:
+            twCC = set_onevalue(pCapability, TWTY_INT32, TWQC_GET);
+            break;
+
+        case MSG_GET:
+            twCC = set_onevalue(pCapability, TWTY_BOOL, TRUE);
+            break;
+
+    }
+    return twCC;
+}
+
 TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action)
 {
     TW_UINT16 twCC = TWCC_CAPUNSUPPORTED;
@@ -301,6 +322,10 @@ TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action)
             twCC = SANE_CAPXferCount (pCapability, action);
             break;
 
+        case CAP_UICONTROLLABLE:
+            twCC = SANE_CAPUiControllable (pCapability, action);
+            break;
+
         case ICAP_PIXELTYPE:
             twCC = SANE_ICAPPixelType (pCapability, action);
             break;
diff --git a/dlls/twain_32/tests/dsm.c b/dlls/twain_32/tests/dsm.c
index 92e322b..31843dc 100644
--- a/dlls/twain_32/tests/dsm.c
+++ b/dlls/twain_32/tests/dsm.c
@@ -95,7 +95,7 @@ static TW_HANDLE alloc_and_set_onevalue(TW_UINT32 val, TW_UINT16 type)
     return hcontainer;
 }
 
-static void check_get(TW_CAPABILITY *pCapability,
+static void check_get(TW_CAPABILITY *pCapability, TW_INT32 actual_support,
                 TW_UINT32 orig_value, TW_UINT32 default_value, TW_UINT32 *suggested_set_value)
 {
     void *p;
@@ -104,7 +104,7 @@ static void check_get(TW_CAPABILITY *pCapability,
     p = GlobalLock(pCapability->hContainer);
     if (p)
     {
-        if (pCapability->ConType == TWON_ONEVALUE)
+        if (pCapability->ConType == TWON_ONEVALUE && actual_support & TWQC_GETCURRENT)
         {
             TW_ONEVALUE *onev = (TW_ONEVALUE *) p;
             ok(onev->Item == orig_value, "MSG_GET of 0x%x returned 0x%x, expecting 0x%x\n",
@@ -233,7 +233,7 @@ static void test_onevalue_cap(TW_IDENTITY *appid, TW_IDENTITY *source, TW_UINT16
         get_condition_code(appid, source, &status);
         ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
                 "Error [rc %d|cc %d] doing MSG_GET for type 0x%x\n", rc, status.ConditionCode, captype);
-        check_get(&cap, orig_value, default_value, &new_value);
+        check_get(&cap, actual_support, orig_value, default_value, &new_value);
         if (rc == TWRC_SUCCESS)
             GlobalFree(cap.hContainer);
     }
@@ -313,8 +313,9 @@ static void test_single_source(TW_IDENTITY *appid, TW_IDENTITY *source)
     if (capabilities[CAP_XFERCOUNT])
         test_onevalue_cap(appid, source, CAP_XFERCOUNT, TWTY_INT16,
             TWQC_GET | TWQC_SET | TWQC_GETDEFAULT | TWQC_GETCURRENT | TWQC_RESET);
-    todo_wine
     ok(capabilities[CAP_UICONTROLLABLE], "CAP_UICONTROLLABLE not supported\n");
+    if (capabilities[CAP_UICONTROLLABLE])
+        test_onevalue_cap(appid, source, CAP_UICONTROLLABLE, TWTY_BOOL, TWQC_GET);
 
     if (source->SupportedGroups & DG_IMAGE)
     {




More information about the wine-cvs mailing list