What does screen number and display number mean in Xlib? - xlib

For example, the foobar:0.1 would specify screen 1 of display 0 on the machine named foobar.
But what does screen number and display number of X server mean in Xlib?
Does it mean that an X server can have many displays, and a display can have many screens, and a screen can have many windows?

"Display" in xlib / x11 protocol terminology is one single connection between client and X server.
"Screen" is actual screen, but things get more complicated here. Each screen has its own root window ( and some more associated properties - physical width/heights, DPI etc ). Because every window on the screen is child of that root window, you can't just move window from one screen to another (all child windows under X11 always clipped by parent). This is one of the reason multiple "screens" as in your question almost never used - most people have multiple monitors configured to be part of one X11 screen using Xinerama/RANDR extensions
To summarise: one display - one connection (if over network, to a port 6000 + display number). Each screen - it's own root window. One client is allowed to have more than one connection to X ( and thus use multiple Display instances )

Related

Creating a "dead area" on the Windows desktop

One of our applications duplicates an area in the top left corner of the monitor and displays it to the public. Any of our other applications are prevented from covering this area, you cannot drag any of them over this area (they hit a "wall"), otherwise they would be visible publicly. However, if a user starts another application, say IE, it can display over the restricted area. Is there a registry setting or something that we can set that will prevent ALL applications from using this part of the desktop, eg. 300x200. I could set this value when our program starts and restore it when it closes, and have a separate application just to restore it just in case! It is not a serious limitation if the whole of the side or top could not be used, ie. if we block out the whole first 300 pixels on the left this would be acceptable. We are running W7-10 depending on the customer, programming is done in Delphi XE (at the moment).

Using ncurses in c language

I'm using ncurses in one of my application in unix server.
My application is in such a way that it displays different set of information.
So I have created different pads to display each content.
Is there a way to use scroll option for these pads at a stretch?
As of now ncurses is limited to screen size, if I have display 3 or more pads at the same time it is not possible because it exceeds the screen size.
Is there any way to do to implement scroll using ncurses in this scenario?
ncurses (any curses library) supports overlapping windows. You do not have to tile (subdivide) the screen.
If you design your program to allow the user to select different views of the data, you can have multiple windows on the screen which use most of it.
For instance, the dialog program in this screenshot is showing overlapping windows (using touchwin and wrefresh). The tab character makes it switch focus to the next window:

Cocoa Accessibility API: Hide a window

I'm looking to hide a window on OSX (not belonging to my app), but not the rest of the application. I have tried simply moving the window off the screen (like I would do in Windows), but the api always positions it at least 20 pixels away from the edge (#annoying).
Other things I have thought of:
Setting the opacity of the window to zero (can this be done?)
Minimizing the window, but it appears that the window handle becomes null once the window is minimized, so might be hard to get back
Setting the window level (i.e. desktop) or z order (can this be done?)
Moving the window to a different workspace (can this be done?)
Does anyone know of a way to do this?

OS X application in full screen mode on two monitor setup

Basically I would like to run OS X application in full screen mode on two monitors. There is no specific layout I would like to accomplish, I would just like to zoom in application to use whole two screens. Only application that I saw behaves that way is parallels.
How do I accomplish that ?
UPDATE:
This application will run only on my personal setup where i have two screens with the same resolution. OSx application contains two tableview's. One table view have one column and second tableview have numerous columns. In fullscreen mode i would like to see as much of those columns from tableview2. Preferable would be that tableview2 stretches to use both screens.
There are several different approaches that you could use:
Create two full screen windows in which you will put two scrollviews
containing two tableviews displaying your data. Then, you will
need to scroll the tableviews to the appropriate position, in order
to display your content. You will also have to synchronize scrolling between the views.
Create one window that you enlarge, so that it spans across the monitor. This will be far easier than solution (1) since your displays are the same size. You have one large tableview. You have to take care of the dock and the toolbar.
Other solutions, requiring more voodoo. Not worthy of detailing.
Pro / Cons
Solution 1: the OS takes care of the dock and the toolbar for you. it is easy to deal with display of different size / resolution. But the setup (programmatically) requires some amount of effort.
Solution 2: Easy to setup. But you have to take care of the dock and the toolbar, and won't really work if the displays are of different size/resolution.

How do you get CreateWindowEx() to create the window on a specific monitor?

I've determined that I can use GetSystemMetrics(SM_CMONITORS) to query the number of attached monitors, but is there any way to control what monitor CreateWindowEx() uses for the window?
Yes, by the "x" and "y" arguments. Use EnumDisplayMonitors (pass two nulls) to enumerate the monitors. Your MonitorEnumProc callback gets a RECT* to the monitor's display rectangle. You'd get a negative RECT.right if a monitor is located at the left of your main one.
Each monitor simply displays some part of the desktop, so showing the window on a particular monitor is a matter of moving the window to the part of the desktop displayed by that monitor. When you call CreateWindowEx (or CreateWindow) you can specify x and y coordinates for the window, so displaying it on a particular monitor simply means specifying coordinates that fall within the area displayed by that monitor.
You can find the work areas for the monitors on a system with GetMonitorInfo.
The x and y parameters specify the location of the new window. This point can be anywhere on the virtual screen (all the monitor rectangles combined).
If you want to create the window on the same monitor as another window you can call MonitorFromWindow. Otherwise can enumerate all the monitors with EnumDisplayMonitors.
Either way, once you have a HMONITOR handle you must then call GetMonitorInfo. Your x and y parameters should be a value inside the bounds of the rcWork member in the monitor info struct. You would normally choose values that puts your window in the center of this rectangle.
It is important to use the workarea rectangle and not the full monitor rectangle because you don't want your window to appear underneath the Taskbar and other always-on-top appbars.

Resources