Bug 25804 - [PATCH] Resize ephyr screen size automatically when parent window is resized.
Summary: [PATCH] Resize ephyr screen size automatically when parent window is resized.
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/DDX/Xephyr (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: Matthew Allum
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2009-12-27 08:03 UTC by Vic Lee
Modified: 2013-05-13 01:36 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
[PATCH] Resize ephyr screen size automatically when parent window is resized. (4.30 KB, patch)
2009-12-27 08:08 UTC, Vic Lee
no flags Details | Splinter Review
Resize ephyr screen automatically when parent window is resized (4.30 KB, patch)
2009-12-28 03:04 UTC, Vic Lee
no flags Details | Splinter Review
Resize ephyr screen automatically when parent window is resized. (4.50 KB, patch)
2010-01-07 06:47 UTC, Vic Lee
no flags Details | Splinter Review
test case (1.31 KB, text/x-csrc)
2010-01-07 07:04 UTC, Vic Lee
no flags Details

Description Vic Lee 2009-12-27 08:03:00 UTC
Issue: When I embed an Xephyr into a parent window, Xephyr scales itself to fix in the parent window size. However, if the parent window resizes, Xephyr does not follow. Xephyr also does not allow to decrease its size because it sets a size hints during startup. This issue is very easy to reproduce.

The attached patch fixed this this issue. This patch does the following things:
1. Do not set size hints if we are using -parent
2. Add StructureNotify event mask
3. Capture configure event and process it if we are using -parent

It reuses the RandR function to resize the screen.

I only tested this patch on 1.6 branch, but probably should work for 1.7. Could you help to review and nominate for 1.7 and 1.8?

By the way, I personally consider this is a bug rather than enhancement. :)
Comment 1 Vic Lee 2009-12-27 08:08:12 UTC
Created attachment 32313 [details] [review]
[PATCH] Resize ephyr screen size automatically when parent window is resized.
Comment 2 Vic Lee 2009-12-27 16:38:11 UTC
Comment on attachment 32313 [details] [review]
[PATCH] Resize ephyr screen size automatically when parent window is resized.

Just found a little problem on this patch. in hostx_get_event(), it should return 0 in case -parent is not set. I will submit a new patch tonight.
Comment 3 Vic Lee 2009-12-28 03:04:55 UTC
Created attachment 32321 [details] [review]
Resize ephyr screen automatically when parent window is resized
Comment 4 Vic Lee 2009-12-28 03:05:46 UTC
OK, this one is better. Please check.
Comment 5 Vic Lee 2010-01-03 01:46:47 UTC
Oh, actually I just found out that I have some problem with this patch when using it in my application. Please don't apply it yet. I will try to figure out what's going on.
Comment 6 Vic Lee 2010-01-07 06:47:22 UTC
Created attachment 32502 [details] [review]
Resize ephyr screen automatically when parent window is resized.
Comment 7 Vic Lee 2010-01-07 07:04:53 UTC
Created attachment 32503 [details]
test case
Comment 8 Vic Lee 2010-01-07 07:15:44 UTC
OK, I finally got the patch right. Additional changes are:
4. Call RRScreenSizeNotify at the end of rrSetConfig is necessary, otherwise the cursor constrain won't get right.
5. Call RROutputSetModes with NULL to remove old modes is necessary, otherwise xrandr will report historical sizes.

Now with the attached test case, there are the following things that can be verify. After started testxephyr, start Xephyr with:
$ Xephyr :1 -parent <window-id> -query localhost

1. In this test case, the window size will change after Xephyr embedded, but before the window shows up. After startup, Xephyr should just follow the new size, and moving cursor around should be no problem.

2. Login to the session. Open a terminal and run xrandr. It should report the current size.

3. Now try to resize the window freely. The session running inside should just follow. For example in a GNOME session, the panel will always follow the screen size. Maximized window will also follow.

4. Run xrandr again, and it should always report the current screen size as the only available size.

Please review... Thanks.
Comment 9 Peter Hutterer 2010-03-03 15:10:41 UTC
Hi Vic

As you may have noticed from the silence here, patch review on bugzilla doesn't always work. To get your patch processed faster, please send it to xorg-devel@lists.freedesktop.org, this way those with more knowledge of this area can review it easier and provide direct feedback.
Thanks.
Comment 10 jbash 2012-01-31 11:56:28 UTC
Will this patch ever be integrated?

At least from my point of view, Xephyr not being resizeable is the main thing that stands in the way of SELinux application sandboxes being genuinely usable. It would really be nice to be able to confine things on an ad-hoc basis.
Comment 11 Peter Hutterer 2013-05-13 01:36:14 UTC
commit 8843aed82e7d69422e7763a35832a2be8f26723f
Author: Vic Lee <llyzs@163.com>
Date:   Mon Jul 30 14:32:09 2012 -0400

    ephyr: Resize screen automatically when parent window is resized


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.