Improve Chatterino extension positioning (#1825)
This adds support for left-side chat
This commit is contained in:
@@ -198,11 +198,12 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
|
|||||||
AttachedWindow::GetArgs args;
|
AttachedWindow::GetArgs args;
|
||||||
args.winId = root.value("winId").toString();
|
args.winId = root.value("winId").toString();
|
||||||
args.yOffset = root.value("yOffset").toInt(-1);
|
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.width = root.value("size").toObject().value("width").toInt(-1);
|
||||||
args.height = root.value("size").toObject().value("height").toInt(-1);
|
args.height = root.value("size").toObject().value("height").toInt(-1);
|
||||||
args.fullscreen = attachFullscreen;
|
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())
|
if (_type.isNull() || args.winId.isNull())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ AttachedWindow *AttachedWindow::get(void *target, const GetArgs &args)
|
|||||||
|
|
||||||
window->fullscreen_ = args.fullscreen;
|
window->fullscreen_ = args.fullscreen;
|
||||||
|
|
||||||
|
window->x_ = args.x;
|
||||||
|
|
||||||
if (args.height != -1)
|
if (args.height != -1)
|
||||||
{
|
{
|
||||||
if (args.height == 0)
|
if (args.height == 0)
|
||||||
@@ -269,10 +271,21 @@ void AttachedWindow::updateWindowRect(void *_attachedPtr)
|
|||||||
// offset
|
// offset
|
||||||
int o = this->fullscreen_ ? 0 : 8;
|
int o = this->fullscreen_ ? 0 : 8;
|
||||||
|
|
||||||
::MoveWindow(hwnd, int(rect.right - this->width_ * scale - o),
|
if (this->x_ != -1)
|
||||||
int(rect.bottom - this->height_ * scale - o),
|
{
|
||||||
int(this->width_ * scale), int(this->height_ * scale),
|
::MoveWindow(hwnd, int(rect.left + this->x_ * scale + o),
|
||||||
true);
|
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_)
|
// if (this->fullscreen_)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public:
|
|||||||
struct GetArgs {
|
struct GetArgs {
|
||||||
QString winId;
|
QString winId;
|
||||||
int yOffset = -1;
|
int yOffset = -1;
|
||||||
|
int x = -1;
|
||||||
int width = -1;
|
int width = -1;
|
||||||
int height = -1;
|
int height = -1;
|
||||||
bool fullscreen = false;
|
bool fullscreen = false;
|
||||||
@@ -53,6 +54,7 @@ private:
|
|||||||
void *target_;
|
void *target_;
|
||||||
int yOffset_;
|
int yOffset_;
|
||||||
int currentYOffset_;
|
int currentYOffset_;
|
||||||
|
int x_ = -1;
|
||||||
int width_ = 360;
|
int width_ = 360;
|
||||||
int height_ = -1;
|
int height_ = -1;
|
||||||
bool fullscreen_ = false;
|
bool fullscreen_ = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user