mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Improve Chatterino extension positioning (#1825)
This adds support for left-side chat
This commit is contained in:
parent
214afc8fc2
commit
e5f3bc9f3f
|
@ -198,11 +198,12 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
|
|||
AttachedWindow::GetArgs args;
|
||||
args.winId = root.value("winId").toString();
|
||||
args.yOffset = root.value("yOffset").toInt(-1);
|
||||
args.x = root.value("size").toObject().value("x").toInt(-1);
|
||||
args.width = root.value("size").toObject().value("width").toInt(-1);
|
||||
args.height = root.value("size").toObject().value("height").toInt(-1);
|
||||
args.fullscreen = attachFullscreen;
|
||||
|
||||
qDebug() << args.width << args.height << args.winId;
|
||||
qDebug() << args.x << args.width << args.height << args.winId;
|
||||
|
||||
if (_type.isNull() || args.winId.isNull())
|
||||
{
|
||||
|
|
|
@ -91,6 +91,8 @@ AttachedWindow *AttachedWindow::get(void *target, const GetArgs &args)
|
|||
|
||||
window->fullscreen_ = args.fullscreen;
|
||||
|
||||
window->x_ = args.x;
|
||||
|
||||
if (args.height != -1)
|
||||
{
|
||||
if (args.height == 0)
|
||||
|
@ -269,10 +271,21 @@ void AttachedWindow::updateWindowRect(void *_attachedPtr)
|
|||
// offset
|
||||
int o = this->fullscreen_ ? 0 : 8;
|
||||
|
||||
::MoveWindow(hwnd, int(rect.right - this->width_ * scale - o),
|
||||
int(rect.bottom - this->height_ * scale - o),
|
||||
int(this->width_ * scale), int(this->height_ * scale),
|
||||
true);
|
||||
if (this->x_ != -1)
|
||||
{
|
||||
::MoveWindow(hwnd, int(rect.left + this->x_ * scale + o),
|
||||
int(rect.bottom - this->height_ * scale - o),
|
||||
int(this->width_ * scale), int(this->height_ * scale),
|
||||
true);
|
||||
}
|
||||
//support for old extension version 1.2
|
||||
else
|
||||
{
|
||||
::MoveWindow(hwnd, int(rect.right - this->width_ * scale - o),
|
||||
int(rect.bottom - this->height_ * scale - o),
|
||||
int(this->width_ * scale), int(this->height_ * scale),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
// if (this->fullscreen_)
|
||||
|
|
|
@ -17,6 +17,7 @@ public:
|
|||
struct GetArgs {
|
||||
QString winId;
|
||||
int yOffset = -1;
|
||||
int x = -1;
|
||||
int width = -1;
|
||||
int height = -1;
|
||||
bool fullscreen = false;
|
||||
|
@ -53,6 +54,7 @@ private:
|
|||
void *target_;
|
||||
int yOffset_;
|
||||
int currentYOffset_;
|
||||
int x_ = -1;
|
||||
int width_ = 360;
|
||||
int height_ = -1;
|
||||
bool fullscreen_ = false;
|
||||
|
|
Loading…
Reference in a new issue