http://bugs.winehq.org/show_bug.cgi?id=24756
Summary: Form do not have transparent region - SetLayeredWindowAttributes do not work Product: Wine Version: 1.3.2 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: shell32 AssignedTo: wine-bugs@winehq.org ReportedBy: alejandro.lavarello@gmail.com
Forms with transparent regions works OK in Windows XP but the transparency not work in Wine 1.3.2.
Transparency is obtained using the Windows API call to SetLayeredWindowAttributes. In more detail, this is the Lazarus code:
------begin of code ------------------------------------------------- unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms,
Controls, StdCtrls, Graphics, Dialogs, ExtCtrls, Windows;
const
LWA_COLORKEY = 1;
LWA_ALPHA = 2;
LWA_BOTH = 3;
WS_EX_LAYERED = $80000;
GWL_EXSTYLE = -20;
{Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal Color As Long, ByVal X As Byte, ByVal alpha As Long) As Boolean }
function SetLayeredWindowAttributes (hWnd:Longint; Color:Longint;
X:Byte; alpha:Longint):bool stdcall; external 'USER32';
{not sure how to alias these functions here ???? alias setwindowlonga!!}
{Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long }
Function SetWindowLongA (hWnd:Longint; nIndex:longint; dwNewLong:longint):longint stdcall; external 'USER32';
{Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long }
Function GetWindowLongA ( hWnd:Longint; nIndex:longint):longint stdcall; external 'user32';
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure Image1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure SetTranslucent(ThehWnd: Longint; Color: Longint; nTrans: Integer);
var
attrib:longint;
begin
{SetWindowLong and SetLayeredWindowAttributes are API functions, see MSDN for details }
attrib := GetWindowLongA(ThehWnd, GWL_EXSTYLE);
SetWindowLongA (ThehWnd, GWL_EXSTYLE, attrib Or WS_EX_LAYERED);
{anything with color value color will completely disappear if flag = 1 or flag = 3 }
SetLayeredWindowAttributes (ThehWnd, Color, nTrans,LWA_COLORKEY);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
transparency:longint;
begin
{the color were going to make transparent the red that the form background is set to}
transparency:= clLime;
{call the function to do it}
SetTranslucent (form1.Handle, transparency, 0);
end;
------end of code -------------------------------------------------
Tested in Wine 1.3.2 under Puppy Linux 4.3.1 and in WineXO under Fedora Remix + Sugar in a XO-1.
http://bugs.winehq.org/show_bug.cgi?id=24756
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|shell32 |-unknown Summary|Form do not have |Form do not have |transparent region - |transparent region |SetLayeredWindowAttributes | |do not work | Severity|normal |minor
--- Comment #1 from Dmitry Timoshkov dmitry@codeweavers.com 2010-10-16 06:47:21 CDT --- What's the Lazarus? Is there a download link?
http://bugs.winehq.org/show_bug.cgi?id=24756
--- Comment #2 from Dmitry Timoshkov dmitry@codeweavers.com 2010-10-16 06:48:06 CDT --- Also it would be much better if you would attach the sample code instead of pasting it.
http://bugs.winehq.org/show_bug.cgi?id=24756
--- Comment #3 from Alejandro Lavarello alejandro.lavarello@gmail.com 2010-10-16 08:15:28 CDT --- Created an attachment (id=31298) --> (http://bugs.winehq.org/attachment.cgi?id=31298) In Windows XP, transparent form is OK.
In real Windows all seems OK.
http://bugs.winehq.org/show_bug.cgi?id=24756
--- Comment #4 from Alejandro Lavarello alejandro.lavarello@gmail.com 2010-10-16 08:40:21 CDT --- (In reply to comment #2)
Also it would be much better if you would attach the sample code instead of pasting it.
In this location:
http://www.megaupload.com/?d=EXRJLO71
you can load the complete source code plus a compiled executable. This is a RAR file of 2.5 MB.
http://bugs.winehq.org/show_bug.cgi?id=24756
--- Comment #5 from Alejandro Lavarello alejandro.lavarello@gmail.com 2010-10-16 08:49:35 CDT --- Created an attachment (id=31299) --> (http://bugs.winehq.org/attachment.cgi?id=31299) In Wine, we no not have transparent forms.
http://bugs.winehq.org/show_bug.cgi?id=24756
--- Comment #6 from Dmitry Timoshkov dmitry@codeweavers.com 2010-10-18 02:26:22 CDT --- (In reply to comment #4)
http://www.megaupload.com/?d=EXRJLO71
you can load the complete source code plus a compiled executable. This is a RAR file of 2.5 MB.
A maximally simplified test attached to this bug report is preferred.
http://bugs.winehq.org/show_bug.cgi?id=24756
--- Comment #7 from Alejandro Lavarello alejandro.lavarello@gmail.com 2010-10-18 07:11:24 CDT --- (In reply to comment #6)
(In reply to comment #4)
http://www.megaupload.com/?d=EXRJLO71
you can load the complete source code plus a compiled executable. This is a RAR file of 2.5 MB.
A maximally simplified test attached to this bug report is preferred.
A maximally simplified test is: use the function SetLayeredWindowAttributes and you can be shure that this Windows API call do not work in Wine. I am a amateur programmer; I was thinking that you are a professional programmer, but I was wrong.
http://bugs.winehq.org/show_bug.cgi?id=24756
Bruno Jesus 00cpxxx@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |00cpxxx@gmail.com Ever Confirmed|0 |1
--- Comment #8 from Bruno Jesus 00cpxxx@gmail.com 2011-10-02 13:00:42 CDT --- I can confirm this issue in latest git.
http://bugs.winehq.org/show_bug.cgi?id=24756
--- Comment #9 from Bruno Jesus 00cpxxx@gmail.com 2012-02-29 10:26:41 CST --- Still present in 1.4-rc5.
http://bugs.winehq.org/show_bug.cgi?id=24756
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |adys.wh@gmail.com
--- Comment #10 from Jerome Leclanche adys.wh@gmail.com 2012-05-05 07:02:32 CDT --- (In reply to comment #9)
This is bug #24890 yes?
http://bugs.winehq.org/show_bug.cgi?id=24756
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE
--- Comment #11 from Jerome Leclanche adys.wh@gmail.com 2012-05-05 07:03:27 CDT --- Dupe
*** This bug has been marked as a duplicate of bug 24890 ***
http://bugs.winehq.org/show_bug.cgi?id=24756
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #12 from Jerome Leclanche adys.wh@gmail.com 2012-05-06 07:06:55 CDT --- Closing