|
Home > Archive > Unix Programming > January 2004 > resize question: XReparentWindow() related
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
resize question: XReparentWindow() related
|
|
| kodgehopper 2004-01-23, 5:18 pm |
| Hi
I'm new to Xwindows programming (tho not to programming itself), and I
have a question involving XReparentWindow(). I'm using XFree86-4.3
What I want is to create a window of a certain size, say 500x500, and
start mplayer (a movie player)in full screen in that window. BUT, I want
mplayer to use 500x500 as it's fullscreen size, and not the size of the
entire screen. In other words, I want mplayer to think the small 500x500
window I've created is the full screen. This must be done transparently.
The user must not have to manually rescale mplayer to the size of the
window. The user must just type -fs (for fullscreen mode) and that must
use the dimensions of the 500x500 window automatically.
At the moment, I'm executing the following sequence of steps:
1. create 500x500 window
2. start mplayer in fullscreen mode
3. reparent mplayer to 500x500 window
The end result is that mplayer uses the dimensions of the entire screen
when going to fullscreen mode, so when it's reparented, I only see a small
portion of the video in the 500x500 window.
I think this happens because mplayer originally starts up as a child of
the root window from which it gets its dimensions for fullscreen mode.
Then when I reparent, it's still using those original settings which is
why I see a clipped version of the video.
So my questions are:
1. How do I get mplayer to use the 500x500 window's dimensions when going
to fullscreen mode? note that mplayer will probably be started from
.xinitrc or some other application, so i can't create the 500x500
window then run exec() from it.
2. Is there a way to trap an event indicating that an application is going
to start running and then force that application to run in the 500x500
window? i.e. force the application to start up originally as a child
window of the 500x500 window, and not of the root window?
Thanks in advance
kodgehopper
kodgehopper at netscape dot/point net
(email specified as above to avoid spam. sorry for the inconveniece)
| |
| Chuck Dillon 2004-01-23, 5:18 pm |
| kodgehopper wrote:quote:
>
> ... In other words, I want mplayer to think the small 500x500
> window I've created is the full screen. This must be done transparently.
>
> ...
>
> So my questions are:
> 1. How do I get mplayer to use the 500x500 window's dimensions when going
> to fullscreen mode? note that mplayer will probably be started from
> .xinitrc or some other application, so i can't create the 500x500
> window then run exec() from it.
There are no easy solutions to this. You could modify a window manager
to have special handling of a particular application but there is no
robust way to identify which application to apply the special handling
to. It would probably be very ugly.
Another posible solution would be to use xnest, which is an xserver
that uses a window of another xserver as the display device, and run
the app against it. That way the app interacts with a real xserver
that is configured as you want it. To direct the app to the embedded
xserver you would have to replace it's binary with a wrapper script.
Again this could get involved if you need a window manager running in
the nested display. I don't think you would though.
quote:
> 2. Is there a way to trap an event indicating that an application is going
> to start running and then force that application to run in the 500x500
> window? i.e. force the application to start up originally as a child
> window of the 500x500 window, and not of the root window?
Use a wrapper script. X doesn't include the concept of an application
or a program. It deals with windows. The best you can do is look for
standard properties and infer from them what app is associated with the
windows. Not all apps follow the conventions and if you don't do this
in a custom window manager it can get tricky.
I suggest you follow-up to comp.windows.x.
-- ced
--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
|
|
|
|
|