Recent

Author Topic: Custom shape forms in Linux ?  (Read 11381 times)

Lightning

  • Sr. Member
  • ****
  • Posts: 422
Custom shape forms in Linux ?
« on: June 29, 2004, 03:22:30 pm »
How do i make a transparent window in Linux Desktop Environments (Kde, Gnome, etc.), in Win i use Regions but i think there's a function in Linux.

Is there any way to get API docs for different platforms, preferably in Object Pascal Language but i would appreciate even those in C/C++.
Thank you in advance.
The future must be... Fast and OpenSource so...
Think Open and Lightning Fast!

Lightning

  • Sr. Member
  • ****
  • Posts: 422
Custom shape forms in Linux ?
« Reply #1 on: July 07, 2004, 02:40:49 pm »
Seems that nobody knows, but what does the TRegion object, is it working ???
The future must be... Fast and OpenSource so...
Think Open and Lightning Fast!

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2621
Custom shape forms in Linux ?
« Reply #2 on: July 08, 2004, 11:52:15 am »
I do know win32 regions and they are not supported yet in the LCL

I don't know about the TRegion object.

about docs:
for win32 see http://mdsn.microsoft.com
for gtk see http://developer.gnome.org/doc/API/
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Lightning

  • Sr. Member
  • ****
  • Posts: 422
Custom shape forms in Linux ?
« Reply #3 on: July 14, 2004, 01:57:42 pm »
TCanvas.Region is of type TRegion, nice, Delphi doesn't have something like this.
How does it work ?
I'm checking the xmms code to see how they achieved transparency, it seems that gtk facilitates region creation and setting.
I know that X Windows has some funcs XPolygonRegion, XSetRegion, etc.
The xlib, xutil translations were made with h2pas but function parameters are something like para1, para2 instead of the normal parameter names, why ? I bellive the Pascal case insensitivity is the reason but para1 is more ugly than let's say parRegion.
What should i use TRegion, X or gtk ?
The future must be... Fast and OpenSource so...
Think Open and Lightning Fast!

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2621
Custom shape forms in Linux ?
« Reply #4 on: July 14, 2004, 05:42:35 pm »
If you wan tto have transparent windows, the interface must support it. AFAIK it doesn't at the moment. So ig you want it, and your app only has to work for GTK, yuo can use the gtk functions directly
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Lightning

  • Sr. Member
  • ****
  • Posts: 422
Custom shape forms in Linux ?
« Reply #5 on: July 16, 2004, 03:38:43 pm »
Thank you Marc, i think MPlayer uses the same GTK specific methods like xmms, i will try using those and then switch to X methods since Regions are slower in Linux (maybe only with GTK) than Windows.
The future must be... Fast and OpenSource so...
Think Open and Lightning Fast!

Lightning

  • Sr. Member
  • ****
  • Posts: 422
Custom shape forms in Linux ?
« Reply #6 on: July 19, 2004, 11:22:20 am »
MPlayer uses XShape func. extensions.
XMMS uses GTK functions.
WinAmp uses Windows Regions.
I think X has standard funcs.
How do i obtaind a Widget ID or GC or other Window related parameters, the Handle parameter of a WinControl is of type HWND so it only works on Windows.
Any crossplatform solution ?
The future must be... Fast and OpenSource so...
Think Open and Lightning Fast!

Drewski

  • Jr. Member
  • **
  • Posts: 55
Custom shape forms in Linux ?
« Reply #7 on: July 19, 2004, 01:49:41 pm »
I looked at the interface code and
by including the GTKProc you can do this
var
fhandle: hwnd;
fGtkWidget: PGtkWidget;
begin
...
fhandle := hwnd(ObjectToGtkObject(YourObject.Handle));
fGtkWidget := PgtkWidget(fhandle);
...
end;

after some googling
I found a site with how to get the xwindow ID from it

Include GKDPrivate

var
priv: PGdkWindowPrivate
xwin: TWindow;
xdisp: PDisplay;

priv := PGdkWindowPrivate(fGtkWidget^.window);
xwin := priv^.xwindow;

xdisp := priv^.xdisplay;

or instead include gdkx

xwin := GDK_WINDOW_XWINDOW (fGtkWidget^.window);
xdisp := GDK_WINDOW_XDISPLAY (fGtkWidget^.window);

I haven't tried any of this out so it may need changes but I think it should get you started :)

Andrew

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2621
Custom shape forms in Linux ?
« Reply #8 on: July 22, 2004, 11:47:46 am »
Quote from: "andyman"
I looked at the interface code and
by including the GTKProc you can do this


Better not to include GTKProc in your own project. This is a interface internal unit and may messup alot.

Quote

var
fhandle: hwnd;
fGtkWidget: PGtkWidget;
begin
...
fhandle := hwnd(ObjectToGtkObject(YourObject.Handle));
fGtkWidget := PgtkWidget(fhandle);
...
end;


you don't need to use ObjectToGtkObject here.  What you hafe indirecly done is retrieving your own handle.

On gtk you still can cast TWinControl.Handle to a PGTKWidget.
This may change in the near future. I'm planning to add a GetWidgetHandle function somewhere someplace soon
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Anonymous

  • Guest
Custom shape forms in Linux ?
« Reply #9 on: January 25, 2005, 08:20:17 pm »
grg:
I tried to retrieve the x window id by casting a handle of a panel and scrollbox to TGtkWidget.
It gets the wrong window id - this of the parent window.
i'm using xid:=pGdkWindowPrivate(gdkwidget^.window.xwindow)

 

TinyPortal © 2005-2018