Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get and set display name for XOpenDisplay() #34

Closed
wants to merge 5 commits into from

Conversation

jub3i
Copy link
Contributor

@jub3i jub3i commented Jul 6, 2015

can be done by just setting DISPLAY env var, but nice if you want more control then you can now set it programmatically. ran into this problem when using ssh.


//Convert arg to c-string
//NOTE: surely better way to go from v8::String to char* ?
std::string name =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this feels pretty dirty, you know better way to accomplish?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work!

NanUtf8String name(arg[0]);
char *display_name = *name;

#include "mouse.h"
#include "deadbeef_rand.h"
#include "keypress.h"
#include "screen.h"
#include "screengrab.h"
#include "MMBitmap.h"
#include "xdisplay.h"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably cause errors on other OSes, right?

@octalmage
Copy link
Owner

If I understand correctly, this allows you to pick the X server you connect to?

@jub3i
Copy link
Contributor Author

jub3i commented Jul 16, 2015

Thanks that argument parsing worked nicely. I fixed up the OS compat issue, although I'm not sure I like how it structured, thought about maybe moving some of it into screen.h to avoid having to use those defines in robotjs.cc.

Yes, that’s exactly the purpose of this code; directly from X(7) under the DISPLAY NAMES section:

From the user's perspective, every X server has a display name of the form: 

hostname:displaynumber.screennumber

This information is used by the application to determine how it should connect to the server and which screen it should use by default (on displays with multiple monitors)...

If your happy with the direction of this PR I can add some docs in README too?

@octalmage
Copy link
Owner

Sorry for the delay, I've been without internet and I want to test this first. I should be able to test tonight or tomorrow.

@octalmage
Copy link
Owner

#206 replaces this.

@octalmage octalmage closed this Jun 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants