How does a fully transparent window receive mouse event?

  • Hi all,
    I'd like to create a fully transparent window that receive mouse event so
    that I can draw stuff "over desktop".
    I do know how to create a transparent window with alpha value 0.
    But seems window server never send me the mouse event when the window is
    fully transparent.
    Does anyone know how to receive mouse event in such circumstance?
    Or any idea will be very appreciated as well. Thanks in advance!

    Best Regards,
    James Chen
    Presentation Product Division
    TEL: +886 2 22263630 ext 8538
    FAX: +886 2 22267241
    Mailto: <Jam.Chen...>
    http://www.avermedia.com
    AVerMedia Technologies, Inc.

    ²³ø²£«~¨Æ·~³æ¦ì: ³¯»Ê±]
    ¶ê­è¬ì§Þ(ªÑ)¤½¥q
    This message contains information that may be confidential and privileged.
    Unless you are the addressee (or authorized to receive messages for the
    addressee), you cannot use, copy or disclose to any third party or any
    information contained in the message. If you have received the message in
    error, please advise the sender by reply e-mail and delete the message.
    Nothing in this message should be interpreted as a digital or electronic
    signature that can be used to authenticate a contract or to other legal
    document. Thank you very much.
  • Am 25.12.2007 um 8:24  schrieb James Chen:
    > I do know how to create a transparent window with alpha value 0.
    > But seems window server never send me the mouse event when the
    > window is
    > fully transparent.

      Maybe you only think you know? How exactly are you doing it? Maybe
    there's something wrong with the way you're making your window
    transparent. Post some code.

    Cheers,
    -- M. Uli Kusterer
    "The Witnesses of TeachText are everywhere..."
    http://www.zathras.de
  • You are right.
    1. I create a window, _MainWindow, with style NSBorderlessWindowMask.
    2. And then
        [_MainWindow makeKeyAndOrderFront:self];
        [_MainWindow setOpaque:NO];
        [_MainWindow setBackgroundColor:[NSColor clearColor]];

    That's it. :)

    Best Regards,
    James Chen
    Presentation Product Division
    TEL: +886 2 22263630 ext 8538
    FAX: +886 2 22267241
    Mailto: <Jam.Chen...>
    http://www.avermedia.com
    AVerMedia Technologies, Inc.

    ²³ø²£«~¨Æ·~³æ¦ì: ³¯»Ê±]
    ¶ê­è¬ì§Þ(ªÑ)¤½¥q
    This message contains information that may be confidential and privileged.
    Unless you are the addressee (or authorized to receive messages for the
    addressee), you cannot use, copy or disclose to any third party or any
    information contained in the message. If you have received the message in
    error, please advise the sender by reply e-mail and delete the message.
    Nothing in this message should be interpreted as a digital or electronic
    signature that can be used to authenticate a contract or to other legal
    document. Thank you very much.

    > From: Uli Kusterer <witness.of.teachtext...>
    > Date: Tue, 25 Dec 2007 10:41:12 +0100
    > To: James Chen <jam.chen...>
    > Cc: Cocoa <cocoa-dev...>
    > Subject: Re: How does a fully transparent window receive mouse event?
    >
    > Am 25.12.2007 um 8:24  schrieb James Chen:
    >> I do know how to create a transparent window with alpha value 0.
    >> But seems window server never send me the mouse event when the
    >> window is
    >> fully transparent.
    >
    >
    > Maybe you only think you know? How exactly are you doing it? Maybe
    > there's something wrong with the way you're making your window
    > transparent. Post some code.
    >
    > Cheers,
    > -- M. Uli Kusterer
    > "The Witnesses of TeachText are everywhere..."
    > http://www.zathras.de
    >
    >
    >
    >
  • Hi James,

    There might be, and probably is, a better way, but if you set the
    window's color to white with an alpha value of 0.05, it's *almost*
    invisible and yet still receives mouse clicks.  I tried this:

    NSRect screenRect = [[NSScreen mainScreen] frame];
    NSWindow *clearWindow = [[NSWindow alloc]
    initWithContentRect:screenRect styleMask:NSBorderlessWindowMask
    backing:NSBackingStoreBuffered  defer:NO];
    [clearWindow setBackgroundColor:[NSColor colorWithDeviceWhite:1.
    alpha:.05]];
    [clearWindow setOpaque:NO];
    [clearWindow setLevel:NSScreenSaverWindowLevel];
    [clearWindow makeKeyAndOrderFront:self];

    and it sort of does the trick.

    Ron

    On 25/12/2007, at 8:50 PM, James Chen wrote:

    > You are right.
    > 1. I create a window, _MainWindow, with style NSBorderlessWindowMask.
    > 2. And then
    > [_MainWindow makeKeyAndOrderFront:self];
    > [_MainWindow setOpaque:NO];
    > [_MainWindow setBackgroundColor:[NSColor clearColor]];
    >
    > That's it. :)
    >
    > Best Regards,
    > James Chen
    >
    >
    >> From: Uli Kusterer <witness.of.teachtext...>
    >> Date: Tue, 25 Dec 2007 10:41:12 +0100
    >> To: James Chen <jam.chen...>
    >> Cc: Cocoa <cocoa-dev...>
    >> Subject: Re: How does a fully transparent window receive mouse event?
    >>
    >> Am 25.12.2007 um 8:24  schrieb James Chen:
    >>> I do know how to create a transparent window with alpha value 0.
    >>> But seems window server never send me the mouse event when the
    >>> window is
    >>> fully transparent.
    >>
    >>
    >> Maybe you only think you know? How exactly are you doing it? Maybe
    >> there's something wrong with the way you're making your window
    >> transparent. Post some code.
    >>
    >> Cheers,
    >> -- M. Uli Kusterer
    >> "The Witnesses of TeachText are everywhere..."
    >> http://www.zathras.de
    >>
    >>
    >>
    >>

  • On Dec 24, 2007, at 11:24 PM, James Chen wrote:

    > I'd like to create a fully transparent window that receive mouse
    > event so
    > that I can draw stuff "over desktop".
    > I do know how to create a transparent window with alpha value 0.
    > But seems window server never send me the mouse event when the
    > window is
    > fully transparent.
    > Does anyone know how to receive mouse event in such circumstance?
    > Or any idea will be very appreciated as well. Thanks in advance!

    Try [window setIgnoresMouseEvents:NO] ?
    --
    David Duncan
    Apple DTS Animation and Printing
    <david.duncan...>
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today