1

Is it possible to display a translucent SWT shell but without using the setAlpha method, so that it will work reliably across all operating systems?

I.e something like the following:

screenshot

Something which could be useful in a screenshot program, where the user wanted to select a screen region to take a screenshot of, he could just drag the translucent shell over it.

Any ideas?

user2790209
  • 339
  • 2
  • 5
  • 17
  • What's wrong with setAlpha, where doesn't it work where you think it should? I think a method specifically designed to set the transparency level of some element is going to be the most reliable way to do it. – John Dvorak Sep 22 '13 at 15:29
  • @JanDvorak On my linux mint it doesn't work, and shows only a black window. – user2790209 Sep 22 '13 at 15:38
  • 1
    Perhaps you should show us some code as `setAlpha` does generally work. – greg-449 Sep 22 '13 at 15:48
  • @greg-449 Just try using setAlpha(0) on a shell and run it on linux, rather than the window going transparent as it does on windows, you'll see a completely black window. – user2790209 Sep 22 '13 at 15:59
  • 1
    Looking at the Shell source for GTK it uses `gtk_window_set_opacity` which requires that a compositing manager is running to work. – greg-449 Sep 22 '13 at 16:11
  • @greg-449 Hence, is there any other way of achieving this, e.g filling the shell with a rectangle and setting the rectangle to be transparent? – user2790209 Sep 22 '13 at 16:18
  • 2
    See this SO answer http://stackoverflow.com/questions/4965219/gtk-x11-semitransparent-windows-w-and-w-o-composite-managers – greg-449 Sep 22 '13 at 16:31

0 Answers0