go-qml / qml

QML support for the Go language
Other
1.96k stars 187 forks source link

Can I get native (X11) window handles? #27

Closed oblitum closed 10 years ago

oblitum commented 10 years ago

I was trying to port a little tool I made with Qt 5.2 to go/qml, but in this tool, I need access to the native X11 handle through the winId() QWindow method for sending a X11 message for setting "always on top" flag for the window (this is just a brightness control tool, so this is applicable). It seems there's no qml.Window method/member that gives me this native handle so I can use it with BurntSushi/xgb? It would be nice to have access for that.

oblitum commented 10 years ago

This simple patch is currently solving the issue for me.

laurent22 commented 10 years ago

I think the scope of the project, currently, might be too limited to create real applications. It's great to support QML but without having access to the rest of the Qt library, there's very little that can be done. So we end up developing a part in Go, then another in C++ and another in C to add the required classes/methods, which is way more complicated than doing everything in C++ from the start . Perhaps rather than add pieces of Qt one by one, we should consider creating a Go binding for it? (Maybe only a partial one?) Obviously that's a major undertaking but I think that's the only way to make QML usable with Go.

oblitum commented 10 years ago

@laurent22 support the rest of Qt is a too big undertaking, and also, a lot of duplication of what the Go libraries offer themself. Fo me, providing good QML with some small extra windowing stuff, like access to native window handles, is the way to go.

oblitum commented 10 years ago

For reference, this is the tool that was ported:

https://github.com/oblitum/backlight

Currently I'm importing my fork while there's no winId functionality here.

laurent22 commented 10 years ago

@oblitum, I've recently tried to implement the text editor example, and just for this I already needed QFont, QFontDatabase, QTextCharFormat and QTextCursor. Maybe I'm missing something though and there's a way to implement this without adding all these classes to the Go package (in which case, it would probably be useful to document how in the doc). If not, the classes would need to be manually added and we're back at either having to support a partial Qt binding at the package level, or having to develop in Go/C/C++.

niemeyer commented 10 years ago

@oblitum That's in. I just tweaked the name slightly as PlatformId, so it's more indicative of its meaning.

@laurent22 Why do you think the project scope is too limited? Nobody said we cannot import further Qt types, and it's in fact easy to do so. The reason the package is named "qml" rather than "qt" is to make it clear that it's not a goal to wrap all of Qt. The goal is creating a good GUI framework, and we can wrap whatever proves useful towards that goal.

oblitum commented 10 years ago

thanks!