Bug 12042

Summary: review multiscreen xephyr patch by Andrew Christian
Product: xorg Reporter: Dodji Seketeli <dodji>
Component: Server/DDX/XephyrAssignee: Dodji Seketeli <dodji>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: enhancement    
Priority: medium CC: vuntz
Version: 7.2 (2007.02)   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on: 12650    
Bug Blocks:    
Attachments:
Description Flags
first version of the patch sent to the mailing list
none
patch that does apply
none
cleaned the patch according to my observations
none
fix a screen number bug in the xephyr windows title
none
cleanup further none

Description Dodji Seketeli 2007-08-17 10:50:01 UTC
I have created this bug to attach the patch sent by Andrew Christian at http://lists.freedesktop.org/archives/xorg/2007-August/026960.html.
Comment 1 Dodji Seketeli 2007-08-17 10:52:20 UTC
Created attachment 11162 [details] [review]
first version of the patch sent to the mailing list

This patch is the original one sent to the mailing list at http://lists.freedesktop.org/archives/xorg/2007-August/026960.html .
Comment 2 Dodji Seketeli 2007-08-17 10:55:49 UTC
Created attachment 11163 [details] [review]
patch that does apply

I have edited the previous patch to make it apply on master.
Comment 3 Dodji Seketeli 2007-08-17 13:50:51 UTC
Hello,

Following my reviewing of the patch, here are some comments.                               

1/ Coding style                                                                             
----------------

* I think you should try to respect to the style used in files you are modifying.

    For instance, there is not space after opening parenthesis and
    before  closing parathesis:

    /*this is bad*/
    +  if (hostx_want_screen_size( screen, &width, &height )

    /*this is good*/
    +  if (hostx_want_screen_size(screen, &width, &height)

* Lines should not be longer than 80 characters.

* You should use two space indentation, in ephyr.c, at least.
  for instance ephyrBlockSigio uses more, and there are more functions like
  that.

*  You should not use c++ style comments (//). Please, rather use /**/.


2/ Multiple screen related variables naming
--------------------------------------------

The name struct EphyrHostScreenVars is a bit misleading IMO. I believe that
structure abstracts a screen, right ? So why not calling it something like
struct EphyrScreen ? You even named them member of EphyrHostXVars that contains
the screens EphyrHostXVars::screens so I think we should easily agree on this
one :-)

I also think you should consistently refer to the EphyrHostScreenVars as
"ephyr_screens", instead of "vars" because "screen" tells more what it is about
than "vars". This is important because it helps the code to be self documented.
    
3/ More code related thoughts
-------------------------------------------
    
* In hostx_set_screen_number():
  you call hostx_set_win_title( vars->info, "" );
  and that empties the Xephyr window's title. That breaks Xephyr behaviour a
  little bit because normally Xephyr windows have the tile: "( ctrl+shift grabs
  mouse and keyboard )". And that title changes when mouse/keyboard is grabed.
  So setting the title to "" breaks that behaviour. 
  
* in hostx_screen_init():
  In think now that the function takes a KdScreenInfo* in parameters, you should
  remove the other paramters from it as the other parameters can be retrieved
  from KdScreenInfo*. So hostx_screen_init() should take only one parameter:
  that KdScreenInfo*

* this is more of a note, but maybe we could make hostx_paint_rect() and
  hostx_paint_debug_rect() could take a struct Rect {int x1, x2, y1, y2;}
  in parameter instead of so  much parameters.

Comment 4 Dodji Seketeli 2007-08-17 14:25:42 UTC
(In reply to comment #2)
> Created an attachment (id=11163) [details]
> patch that does apply
> 
> I have edited the previous patch to make it apply on master.
> 

Sorry, I forgot to say here that the patch did not apply to master because it was corrupted. The patch sent to the mailing list cannot be applied because I think the mailer of the sender wraps long lines and thus corrupts patches.
Comment 5 Dodji Seketeli 2007-09-28 11:15:39 UTC
Created attachment 11813 [details] [review]
cleaned the patch according to my observations

I edited the patch slightly for:

* better legibility and style conformance with the rest of the code

* create only one card and set all the screens to the same card. The initial patch was creating several card,s each of them having only one screen. That was confusing because all the screens were having the same screen number, which was 0.

* make sure we are not obliged to provide a -screen WIDTHxSIZE option to Xephyr.  When no -screen option is provided, Xephyr just creates one screen as it was doing before. The initial patch was requiring the presence of a -screen option. Xephyr would not even launch if no -screen option was provided.
Comment 6 Dodji Seketeli 2007-09-28 11:17:48 UTC
I will wait a little bit to expect a review for #11813 and will commit it into master. That patch seems to be working okay for me now.
Comment 7 Dodji Seketeli 2007-10-01 05:47:14 UTC
Created attachment 11837 [details] [review]
fix a screen number bug in the xephyr windows title

Fixed a problem I introduced. The xephyr windows titles were not showing the right screen numbers.
Comment 8 Dodji Seketeli 2007-10-02 02:02:47 UTC
Created attachment 11853 [details] [review]
cleanup further

Put back full title display, but try do it properly this time.
Comment 9 Dodji Seketeli 2007-10-02 03:01:35 UTC
Okay testing the patch further showed that windows that are sent to the second screen (or any screen but the first one) don't receive mouse events.

It seems the bug is in the server core code.

I have entered bug #12650 to track it.
Comment 10 Dodji Seketeli 2007-10-02 05:09:58 UTC
Okay I finally pushed the patch to the xserver master branch.
Commit is e5e6514ffa0fd132e0cc1b15b94119e6e8755f43.

This should close the bug.

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.