Hi,

here is a small patch that allows me to make Adobe Photoshop Lightroom 4.x work very well with wine 1.5.17.

First let me recall that Adobe Photoshop Lightroom is *the* catalog and raw development application for professional photographers and hobbyists.

The patch has two parts. The first part essentially modifies the file sync.c from the kernel32 dll and implements some functions related to Condition Variables. I found an original patch by Marcus Meissner and I fixed it because it led to a 100% CPU load. I tried to contact Marcus to discuss my changes with him, but he didn't answer and so I submit my changes to this list, otherwise my work would be lost...

The second part modifies the file menu.c from the user32 dll. It allows the menu bar to appear in Lightroom when the windows version is set to winxp. I'm not the author of this patch but if I remember well, I found it several monthes ago somewhere in the wine patch list.

With the patch applied, I was able to run Lightroom 4.2 flawessly, and it's very stable. I (and other users) have found only minor bugs (like a limitation of the number of shown thumbnails to 455 per folder on a 22 inches display) but the patch is a huge step forward for Lightroom.

Here is a link where I explain the whole installation procedure (message #34) : http://www.pentaxforums.com/forums/digital-processing-software-printing/159894-lightroom-3-4-linux-its-alive-working-pretty-well-3.html

I apologize because I don't have the skills to write a test for the functions of this patch...

Have a nice day,
RB



--
X File Explorer http://roland65.free.fr/xfe
TexMaths http://roland65.free.de/texmaths
Toutes Choses http://roland65.free.fr/ttc
diff -ruN wine-1.5.17.orig/dlls/kernel32/kernel32.spec wine-1.5.17/dlls/kernel32/kernel32.spec
--- wine-1.5.17.orig/dlls/kernel32/kernel32.spec	2012-11-09 19:46:37.000000000 +0100
+++ wine-1.5.17/dlls/kernel32/kernel32.spec	2012-11-12 17:35:35.233372898 +0100
@@ -745,6 +745,7 @@
 @ stdcall IdnToUnicode(long wstr long ptr long)
 @ stdcall InitAtomTable(long)
 @ stdcall InitializeSRWLock(ptr)
+@ stdcall InitializeConditionVariable(ptr)
 @ stdcall InitializeCriticalSection(ptr)
 @ stdcall InitializeCriticalSectionAndSpinCount(ptr long)
 @ stdcall InitializeCriticalSectionEx(ptr long long)
@@ -1187,6 +1188,7 @@
 @ stdcall SignalObjectAndWait(long long long long)
 @ stdcall SizeofResource(long long)
 @ stdcall Sleep(long)
+@ stdcall SleepConditionVariableCS(ptr ptr long)
 @ stdcall SleepEx(long long)
 @ stdcall SuspendThread(long)
 @ stdcall SwitchToFiber(ptr)
@@ -1256,6 +1258,8 @@
 @ stdcall WaitForSingleObjectEx(long long long)
 @ stdcall WaitNamedPipeA (str long)
 @ stdcall WaitNamedPipeW (wstr long)
+@ stdcall WakeAllConditionVariable (ptr)
+@ stdcall WakeConditionVariable (ptr)
 @ stdcall WerRegisterFile(wstr long long)
 @ stdcall WerRegisterMemoryBlock(ptr long)
 @ stdcall WerRegisterRuntimeExceptionModule(wstr ptr)
diff -ruN wine-1.5.17.orig/dlls/kernel32/sync.c wine-1.5.17/dlls/kernel32/sync.c
--- wine-1.5.17.orig/dlls/kernel32/sync.c	2012-11-09 19:46:37.000000000 +0100
+++ wine-1.5.17/dlls/kernel32/sync.c	2012-11-12 17:35:53.392372911 +0100
@@ -2293,3 +2293,69 @@
                   "ret $4")
 
 #endif  /* __i386__ */
+
+
+/**********************************************************************
+ *           InitializeConditionVariable     (KERNEL32.@)
+ */
+VOID WINAPI InitializeConditionVariable(PCONDITION_VARIABLE variable)
+{
+    variable->Ptr = 0;
+    FIXME("(%p) semi-correct stub\n", variable);
+}
+
+/**********************************************************************
+ *           WakeConditionVariable     (KERNEL32.@)
+ */
+VOID WINAPI WakeConditionVariable(PCONDITION_VARIABLE variable)
+{
+    LONG ret;
+    FIXME("(%p) semi-correct stub\n", variable);
+    ret = InterlockedDecrement((PLONG)&variable->Ptr);
+    /* don't go below 0 */
+    if (!ret) InterlockedExchange((PLONG)&variable->Ptr, 0);
+}
+
+/**********************************************************************
+ *           WakeConditionVariable     (KERNEL32.@)
+ */
+VOID WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE variable)
+{
+    FIXME("(%p) semi-correct stub\n", variable);
+    InterlockedExchange((PLONG)&variable->Ptr, 0);
+}
+
+/**********************************************************************
+ *           SleepConditionVariableCS     (KERNEL32.@)
+ */
+BOOL WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE variable,
+    LPCRITICAL_SECTION crit, DWORD milliseconds
+)
+{
+    static int cnt = 0;
+    LONG initval, val;
+    BOOL ret=TRUE;
+
+    if (cnt++ < 10)
+        FIXME("(%p, %p, %d): semi-correct stub.\n", variable, crit, milliseconds);
+    RtlLeaveCriticalSection(crit);
+    initval = *((PLONG)&variable->Ptr);
+    val = InterlockedIncrement((PLONG)&variable->Ptr);
+    if (milliseconds == INFINITE) {
+        while (initval < *((PLONG)&variable->Ptr))
+            SleepEx(100,TRUE);
+    } else {
+        while ((milliseconds > 0) && (initval < *((PLONG)&variable->Ptr))) {
+            DWORD ms = 100;
+            if (ms>milliseconds)
+                ms = milliseconds;
+            SleepEx(ms,TRUE);
+            milliseconds -= ms;
+        }      
+        if (milliseconds <= 0)
+			ret=FALSE;
+    }
+    /* FIXME: make atomic? */
+    RtlEnterCriticalSection(crit);
+    return ret;
+}
diff -ruN wine-1.5.17.orig/dlls/user32/menu.c wine-1.5.17/dlls/user32/menu.c
--- wine-1.5.17.orig/dlls/user32/menu.c	2012-11-09 19:46:37.000000000 +0100
+++ wine-1.5.17/dlls/user32/menu.c	2012-11-12 17:35:35.241372535 +0100
@@ -5067,9 +5067,9 @@
      item = MENU_FindItem (&hMenu, &uItem, MF_BYPOSITION);
      referenceHwnd = hwnd;
 
+	 itemMenu = MENU_GetMenu(hMenu);
      if(!hwnd)
      {
-	 itemMenu = MENU_GetMenu(hMenu);
 	 if (itemMenu == NULL)
 	     return FALSE;
 
@@ -5083,7 +5083,19 @@
 
      *rect = item->rect;
 
-     MapWindowPoints(referenceHwnd, 0, (LPPOINT)rect, 2);
+     if (itemMenu && !(itemMenu->wFlags & MF_POPUP))
+     {
+         /* Perhaps this special case should be eliminated and the coordinates
+          * should be relative to client area instead of window frame */
+         RECT rectWnd;
+         GetWindowRect(referenceHwnd, &rectWnd);
+         rect->top += rectWnd.top;
+         rect->bottom += rectWnd.top;
+         rect->left += rectWnd.left;
+         rect->right += rectWnd.left;
+     }
+     else
+     	MapWindowPoints(referenceHwnd, 0, (LPPOINT)rect, 2);
 
      return TRUE;
 }


Reply via email to