Bug 461486 - [API] Disable the move of a shell
Summary: [API] Disable the move of a shell
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.5   Edit
Hardware: PC All
: P3 enhancement (vote)
Target Milestone: 4.6 M3   Edit
Assignee: Jonas Helming CLA
QA Contact:
URL:
Whiteboard:
Keywords: api, noteworthy
Depends on:
Blocks:
 
Reported: 2015-03-05 06:19 EST by Alexandra Buzila CLA
Modified: 2015-10-27 05:11 EDT (History)
10 users (show)

See Also:


Attachments
Windows Patch to fix SWT.NO_MOVE + SWT.TITLE style combination (749 bytes, patch)
2015-09-04 06:43 EDT, Niraj Modi CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandra Buzila CLA 2015-03-05 06:19:44 EST
Currently, there's no direct way in SWT for disabling the move of a shell, other than using the NO_TRIM style hint, that also removes the titlebar and other other trim styles.

However, this can be achieved in gtk (we tested this with gtk2, in CentOs running Metacity) and win32 (with Windows8.1).
For gtk, one would have to call the gdk_window_set_functions [1] without the GDK_FUNC_MOVE hint[2], while for Windows one would have to disable the SC_MOVE menu item from the window's menu.

We were thinking about adding a new style hint to the SWT class and name it NO_MOVE or NOT_MOVABLE.

What are your thoughts on this? Would you be interested in a contribution?

Best wishes,
Alexandra


[1] https://developer.gnome.org/gdk2/stable/gdk2-Windows.html#gdk-window-set-functions
[2] https://developer.gnome.org/gdk2/stable/gdk2-Windows.html#GdkWMFunction
[3] https://msdn.microsoft.com/en-us/library/windows/desktop/ms646360(v=vs.85).aspx
Comment 1 Leo Ufimtsev CLA 2015-03-05 09:58:00 EST
I'm curious, what's the use-case scenario for this?
Comment 2 Alexandra Buzila CLA 2015-03-05 10:15:33 EST
Hi Leo,

We have an e4 application with a perspective and two windows. 
One of the windows should have a title and be minimizable and closeable, but not movable.
Comment 3 Leo Ufimtsev CLA 2015-03-05 10:21:44 EST
What is the reason for making it 'unmovable' thou :-) ?

I'm not so much opposing it, just curious...
Comment 4 Jonas Helming CLA 2015-03-08 22:15:53 EDT
Hi Leo,

we are dealing with an application which is deployed on a fixed setup of displays. Imagine a control room with mutliple displays. In this scenarios some windows are manditory to been shown at a certain place and therefore it should not be possible to move them.

Cheers

Jonas
Comment 5 Leo Ufimtsev CLA 2015-03-11 11:39:09 EDT
From the SWT/GTK side of things, a gtk3[1] function exists and isn't deprecated.

You'll probably have to add a custom function to OS.java. [2]

I wouldn't mind doing the testing part for Gtk2/Gtk3. But for theoretical notion of having such feature in gtk, it would be nice to hear from Alex/Arun.


[1] https://developer.gnome.org/gdk3/stable/gdk3-Windows.html#gdk-window-set-functions

[2] If of use, here are some  notes on adding custom functions to swt/gtk:
http://leoufimtsev.github.io./org/swt-dev.html#sec-2-3
Comment 6 Alexander Kurtakov CLA 2015-03-11 12:26:31 EDT
Let me remind you that in order to add new API to SWT it has to be implemented on supported WSs - GTK/Win32/Cocoa.
Comment 7 Eclipse Genie CLA 2015-04-24 10:07:36 EDT
New Gerrit change created: https://git.eclipse.org/r/46429
Comment 8 Alexandra Buzila CLA 2015-04-24 10:10:50 EDT
Hi,

I have pushed a commit to Gerrit, that adds the functionality for the SWT.NO_MOVE flag for Win32, Cocoa and gtk. 

The gtk code was tested for gtk2 and Metacity.

Cheers,
Alexandra
Comment 9 Sravan Kumar Lakkimsetti CLA 2015-04-27 04:28:02 EDT
This is API release. The api for 4.5 release has been frozen so will have a look at this in 4.6 release
Comment 10 Alexandra Buzila CLA 2015-07-21 04:23:22 EDT
I've rebased the change on the latest master.
Comment 11 Jonas Helming CLA 2015-07-28 09:53:36 EDT
Does someone have the time to review this? Thanks in advance!
Comment 12 Sravan Kumar Lakkimsetti CLA 2015-08-03 07:20:23 EDT
This requires some testing before pushing into the master. So targetting for M2
Comment 13 Eclipse Genie CLA 2015-08-17 08:03:45 EDT
New Gerrit change created: https://git.eclipse.org/r/53872
Comment 14 Sravan Kumar Lakkimsetti CLA 2015-08-19 04:08:59 EDT
I have tested this patch. I found a couple of issues

1. When you create a shell without any style, we create with shell trim. If we set only no move style. shell is getting created with No trim. I think this should be mentioned as javadoc saying that this bit has to be used in conjunction with other styles and if only no move is set it will create shell with No trim.

2. When I use shell_trim no move does not work on linux. I think this is probably down to Resize bit. Need to define what should happen when Resize and No_move are set. currently no move does not work.

3. Need to updated shell class constructors javadoc to specify the new style bit
Comment 15 Sravan Kumar Lakkimsetti CLA 2015-08-19 04:38:14 EDT
I am using compiz desktop manager.
Comment 16 Niraj Modi CLA 2015-09-04 06:43:13 EDT
Created attachment 256386 [details]
Windows Patch to fix SWT.NO_MOVE + SWT.TITLE style combination

Hi Alexandra,
Please apply above changes in your gerrit patch to make SWT.NO_MOVE + SWT.TITLE style combination work on Windows as well.

Once this is in, we can have TITLE style default with NO_MOVE for all platforms.
Comment 18 Sravan Kumar Lakkimsetti CLA 2015-09-22 06:17:17 EDT
Reviewed the code for control example https://git.eclipse.org/r/53872. this code looks good and can be committed

This code is not compiling trough gerrit as the api change is not available in the gerrit baseline. So committing through eclipse itself.

Committed trough https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=14c42fa651f58062c3fa5f5a0facc201e359da1a
Comment 19 Markus Keller CLA 2015-09-24 08:04:40 EDT
Please fix the problems reported by API Tools:

- Missing @since tag on NO_MOVE	SWT.java
- The minor version should be incremented in version 3.104.0, since new APIs have been added since version 3.104.0	MANIFEST.MF
Comment 20 Eclipse Genie CLA 2015-09-28 06:31:10 EDT
New Gerrit change created: https://git.eclipse.org/r/56831
Comment 22 Lakshmi P Shanmugam CLA 2015-09-30 05:06:12 EDT
(In reply to Markus Keller from comment #19)
> Please fix the problems reported by API Tools:
> 
> - Missing @since tag on NO_MOVE	SWT.java
Fixed by commit in comment 21.

> - The minor version should be incremented in version 3.104.0, since new APIs
> have been added since version 3.104.0	MANIFEST.MF
Fixed by Bug 478520.
Comment 23 Sravan Kumar Lakkimsetti CLA 2015-10-27 05:11:03 EDT
Verified in I20151026-2000 on GTK2 x86 platform