Set the window of an eclipse e4 application to have based screen size - eclipse-rcp

I followed the below link to open window size as whole screen size, it's working fine for windows os but linux os small size window is opening.
How to open screen sized window in linux os just like windows os?
Window Size link

An alternative way to maximize the window is to do the following in the #ProcessAdditions method of your Life Cycle class (if you have one):
#ProcessAdditions
public void processAdditions(final MApplication app, final EModelService modelService)
{
MWindow window = (MWindow)modelService.find("id of top window", app);
Monitor monitor = Display.getCurrent().getPrimaryMonitor();
Rectangle monitorClientArea = monitor.getClientArea();
window.setX(monitorClientArea.x);
window.setY(monitorClientArea.y);
window.setWidth(monitorClientArea.width);
window.setHeight(monitorClientArea.height);
}

Related

Set the size and position of windows on current or specific screen in Swift MacOS [duplicate]

Beginner question:
I am working on a macOS App with current Xcode 8.3.3 and Swift3. I am using MASShortcut to open a window by a shortcut that has been hidden by startup.
I use the following code on the shortcut event:
NSApplication.shared().windows.last!.makeKeyAndOrderFront(nil)
NSApplication.shared().activate(ignoringOtherApps: true)
For multiple monitor setups (I have two external displays attached to my MacBook), I want to specify the screen where the window pops up. I know there is NSScreen.screens() that gives back all available screens. But how do I use it for letting my window pop up on screen 1/2/3?
Thanks a lot!
Edit: Solved with the answer of #michael-doltermann:
I can iterate over NSScreen.screens() and access for example the midX/midY coords to create a NSPoint instance to replace my window.
var pos = NSPoint()
pos.x = NSScreen.screens()![myIndex].visibleFrame.midX)
pos.y = NSScreen.screens()![myIndex].visibleFrame.midY)
self.window?.setFrameOrigin(pos)
Each screen from NSScreen.screens() has a visibleFrame property that tells you the global frame rectangle.
You can then set your window origin to fit inside the frame rect coordinates of whatever screen you want. Objective-C answers can be seen here and here.
This does mean you have to write some code to specify the preferred window. In my own app, I take the global frame rectangles for each screen and then scale them way down into a NSView to display something that looks like the Monitors pane from System Preferences:

How can I get the on screen keyboard for flutter web apps running on a touch screen

I am building flutter for the web, and I want to use it on a touch screen. My app runs great and takes input from the mouse, but when I want to use a text input field the app works with the physical keyboard that I have attached since I'm running in chrome on my Macbook. I would like to use this web app on a touch screen kiosk type of setup though so I wanted to always bring up the virtual (on screen) keyboard for text entry.
I tried:
#override
void initState() {
SystemChannels.textInput.invokeMethod('TextInput.show');
super.initState();
}
And this does force open the virtual keyboard if I run on a virtual tablet for example, but didn't work for me when I ran the exact same flutter app in chrome.
I'm running with v1.9.1+hotfix.3-pre.1, on Mac OS X 10.14.6 18G103
Does Anyone know a way to force flutter to always use virtual on screen keyboard?
I don't think there's a native function in Flutter to invoke the desktop virtual keyboard. As a workaround you can either use virtual_keybaord_multi_language plugin that creates a keyboard within the app or you can enable the virtual keyboard by default on the device. If you're running on Windows, switching to tablet mode should automatically invoke the softkeyboard when a TextField is active.
Edit: This seems to be a valid use case, you can track the feature request on this ticket.

How to make a running application on macos to float above other apps?

I am making an application that can set a running application window to float above other apps so that if you click outside of the app's window, its window will still remain on the screen.
I have tried to use app.activate(options: NSApplication.ActivationOptions.activateIgnoringOtherApps) where app is the frontmost running application set by app = NSWorkspace.shared.frontmostApplication, but this method only shows the window and when you click outside the app it hides again.
func setAppFloating() {
let app = NSWorkspace.shared.frontmostApplication
app?.activate(options: NSApplication.ActivationOptions.activateIgnoringOtherApps)
}
I want to set the window of the running application to Floating so that when you click outside the window, the app should still remain visible above other apps.

How to set the task switcher icon text?

In my SWT application I want to set the OS task switcher (Alt-Tab) icon and its text caption. Setting the icon works OK, but its caption while Alt-Tab switching among apps is always "SWT", not the String I set it to.
I'm primarily interested in this working in Linux (Ubuntu), but it should work cross-platform as SWT, right?
Display display = new Display();
Shell shell = new Shell(display);
shell.setImage
(new Image (display, loadSvgImage().scaledTo(500, 500)));
shell.setText("SuperApp");
This is the application name. You set it with Display.setAppName which must be called before you create the display:
Display.setAppName("appname");
Display display = new Display();

SWT: How to “render” a Widget in the background / into an offscreenbuffer

I would very much appreciate your advice and help:
How can I render a SWT Widget/Component in the BACKGROUND (offscreenbuffer?) and get the “painted” pixels that were drawn by the Widget/Component to save them on the harddisk:
What I currently have is:
Display display = new Display();
Shell shell = new Shell(display);
// ...
MyWidgetComponent mwc = new MyWidgetComponent(shell, SWT.BORDER);
shell.open();
Image screenshot = new Image(shell.getDisplay(), shell.getBounds());
GC.copyArea(screenshot, 0, 0);
//...
Problem:
Taking the screenshot itself of the shell/widget works, but it will open a new Window in the Taskbar. That is something I do NOT want.
What I want to achieve is:
I want to run this application completely in the background as a “server application” (for example embed and call this into a servlet). So the MyWidgetComponent should be rendered pixel by pixel completely in the offscreenbuffer and I later I retrieve the pixels and save them to the harddisk or directly return the rendered widget as an image as the result of the servlet-request. (I do not want to popup any windows in a server environment, in case this might be a windows server...).
How can I achieve this. I searched a lot but havent found anything useful.
Thank you very much!!
Jan
I can't answer your question directly, but I have run into a similar problem that I struggled with: taking a screenshot of a Shell or Widget while it is obstructed from view.
Consider, for instance, window A that overlaps window B. A screenshot is made of B using your code:
Image screenshot = new Image(shellB.getDisplay(), shellB.getBounds());
GC.copyArea(screenshot, 0, 0);
My findings revealed that this could be done under Windows Vista, Windows 7 and Mac OS X (although I'm unsure about the latter). However, under Windows XP, Linux with GNOME and Linux with KDE, the screenshot contains a white area where the overlapping window obstructs the view.
I haven't found a solution for this, and I suspect that not only is this behavior platform dependent, but also fairly buggy in SWT.
I'd love to hear that I'm off the mark, though!