GTK: respect the scale factor when computing coordinates.
This doesn't bring true HiDPI support yet, since there are no HiDPI assets anyway, but it makes the interface usable.
This commit is contained in:
parent
fb667fb8bb
commit
96476ca2e5
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: SolveSpace 3.0\n"
|
"Project-Id-Version: SolveSpace 3.0\n"
|
||||||
"Report-Msgid-Bugs-To: whitequark@whitequark.org\n"
|
"Report-Msgid-Bugs-To: whitequark@whitequark.org\n"
|
||||||
"POT-Creation-Date: 2017-01-11 03:01+0000\n"
|
"POT-Creation-Date: 2017-01-11 03:38+0000\n"
|
||||||
"PO-Revision-Date: 2017-01-05 10:30+0000\n"
|
"PO-Revision-Date: 2017-01-05 10:30+0000\n"
|
||||||
"Last-Translator: Automatically generated\n"
|
"Last-Translator: Automatically generated\n"
|
||||||
"Language-Team: none\n"
|
"Language-Team: none\n"
|
||||||
@ -1478,7 +1478,7 @@ msgctxt "button"
|
|||||||
msgid "OK"
|
msgid "OK"
|
||||||
msgstr "OK"
|
msgstr "OK"
|
||||||
|
|
||||||
#: platform/cocoamain.mm:1208 platform/gtkmain.cpp:1377
|
#: platform/cocoamain.mm:1208 platform/gtkmain.cpp:1379
|
||||||
#: platform/w32main.cpp:1395 platform/w32main.cpp:1435
|
#: platform/w32main.cpp:1395 platform/w32main.cpp:1435
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
msgid "Property Browser"
|
msgid "Property Browser"
|
||||||
@ -1573,12 +1573,12 @@ msgctxt "button"
|
|||||||
msgid "_No"
|
msgid "_No"
|
||||||
msgstr "_No"
|
msgstr "_No"
|
||||||
|
|
||||||
#: platform/gtkmain.cpp:1300 platform/w32main.cpp:176
|
#: platform/gtkmain.cpp:1302 platform/w32main.cpp:176
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr "Error"
|
msgstr "Error"
|
||||||
|
|
||||||
#: platform/gtkmain.cpp:1300 platform/w32main.cpp:176
|
#: platform/gtkmain.cpp:1302 platform/w32main.cpp:176
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
msgid "Message"
|
msgid "Message"
|
||||||
msgstr "Message"
|
msgstr "Message"
|
||||||
|
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: SolveSpace 3.0\n"
|
"Project-Id-Version: SolveSpace 3.0\n"
|
||||||
"Report-Msgid-Bugs-To: whitequark@whitequark.org\n"
|
"Report-Msgid-Bugs-To: whitequark@whitequark.org\n"
|
||||||
"POT-Creation-Date: 2017-01-11 03:01+0000\n"
|
"POT-Creation-Date: 2017-01-11 03:37+0000\n"
|
||||||
"PO-Revision-Date: 2017-01-05 10:30+0000\n"
|
"PO-Revision-Date: 2017-01-05 10:30+0000\n"
|
||||||
"Last-Translator: appsoft@ua.fm\n"
|
"Last-Translator: appsoft@ua.fm\n"
|
||||||
"Language-Team: OpenOrienteeringUkraine\n"
|
"Language-Team: OpenOrienteeringUkraine\n"
|
||||||
@ -1324,7 +1324,7 @@ msgctxt "button"
|
|||||||
msgid "OK"
|
msgid "OK"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: platform/cocoamain.mm:1208 platform/gtkmain.cpp:1377
|
#: platform/cocoamain.mm:1208 platform/gtkmain.cpp:1379
|
||||||
#: platform/w32main.cpp:1395 platform/w32main.cpp:1435
|
#: platform/w32main.cpp:1395 platform/w32main.cpp:1435
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
msgid "Property Browser"
|
msgid "Property Browser"
|
||||||
@ -1413,12 +1413,12 @@ msgctxt "button"
|
|||||||
msgid "_No"
|
msgid "_No"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: platform/gtkmain.cpp:1300 platform/w32main.cpp:176
|
#: platform/gtkmain.cpp:1302 platform/w32main.cpp:176
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: platform/gtkmain.cpp:1300 platform/w32main.cpp:176
|
#: platform/gtkmain.cpp:1302 platform/w32main.cpp:176
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
msgid "Message"
|
msgid "Message"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: SolveSpace 3.0\n"
|
"Project-Id-Version: SolveSpace 3.0\n"
|
||||||
"Report-Msgid-Bugs-To: whitequark@whitequark.org\n"
|
"Report-Msgid-Bugs-To: whitequark@whitequark.org\n"
|
||||||
"POT-Creation-Date: 2017-01-11 03:01+0000\n"
|
"POT-Creation-Date: 2017-01-11 03:38+0000\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -1288,7 +1288,7 @@ msgctxt "button"
|
|||||||
msgid "OK"
|
msgid "OK"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: platform/cocoamain.mm:1208 platform/gtkmain.cpp:1377 platform/w32main.cpp:1395
|
#: platform/cocoamain.mm:1208 platform/gtkmain.cpp:1379 platform/w32main.cpp:1395
|
||||||
#: platform/w32main.cpp:1435
|
#: platform/w32main.cpp:1435
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
msgid "Property Browser"
|
msgid "Property Browser"
|
||||||
@ -1376,12 +1376,12 @@ msgctxt "button"
|
|||||||
msgid "_No"
|
msgid "_No"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: platform/gtkmain.cpp:1300 platform/w32main.cpp:176
|
#: platform/gtkmain.cpp:1302 platform/w32main.cpp:176
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: platform/gtkmain.cpp:1300 platform/w32main.cpp:176
|
#: platform/gtkmain.cpp:1302 platform/w32main.cpp:176
|
||||||
msgctxt "title"
|
msgctxt "title"
|
||||||
msgid "Message"
|
msgid "Message"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -424,8 +424,8 @@ private:
|
|||||||
void ij_to_xy(double i, double j, int &x, int &y) {
|
void ij_to_xy(double i, double j, int &x, int &y) {
|
||||||
// Convert to xy (vs. ij) style coordinates,
|
// Convert to xy (vs. ij) style coordinates,
|
||||||
// with (0, 0) at center
|
// with (0, 0) at center
|
||||||
x = (int)i - _w / 2;
|
x = (int)(i * get_scale_factor()) - _w / 2;
|
||||||
y = _h / 2 - (int)j;
|
y = _h / 2 - (int)(j * get_scale_factor());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -564,8 +564,8 @@ std::unique_ptr<GraphicsWindowGtk> GW;
|
|||||||
|
|
||||||
void GetGraphicsWindowSize(int *w, int *h) {
|
void GetGraphicsWindowSize(int *w, int *h) {
|
||||||
Gdk::Rectangle allocation = GW->get_widget().get_allocation();
|
Gdk::Rectangle allocation = GW->get_widget().get_allocation();
|
||||||
*w = allocation.get_width();
|
*w = allocation.get_width() * GW->get_scale_factor();
|
||||||
*h = allocation.get_height();
|
*h = allocation.get_height() * GW->get_scale_factor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InvalidateGraphics(void) {
|
void InvalidateGraphics(void) {
|
||||||
@ -1129,7 +1129,8 @@ protected:
|
|||||||
bool on_motion_notify_event(GdkEventMotion *event) override {
|
bool on_motion_notify_event(GdkEventMotion *event) override {
|
||||||
SS.TW.MouseEvent(/*leftClick*/ false,
|
SS.TW.MouseEvent(/*leftClick*/ false,
|
||||||
/*leftDown*/ event->state & GDK_BUTTON1_MASK,
|
/*leftDown*/ event->state & GDK_BUTTON1_MASK,
|
||||||
event->x, event->y);
|
event->x * get_scale_factor(),
|
||||||
|
event->y * get_scale_factor());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1137,7 +1138,8 @@ protected:
|
|||||||
bool on_button_press_event(GdkEventButton *event) override {
|
bool on_button_press_event(GdkEventButton *event) override {
|
||||||
SS.TW.MouseEvent(/*leftClick*/ event->type == GDK_BUTTON_PRESS,
|
SS.TW.MouseEvent(/*leftClick*/ event->type == GDK_BUTTON_PRESS,
|
||||||
/*leftDown*/ event->state & GDK_BUTTON1_MASK,
|
/*leftDown*/ event->state & GDK_BUTTON1_MASK,
|
||||||
event->x, event->y);
|
event->x * get_scale_factor(),
|
||||||
|
event->y * get_scale_factor());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1258,8 +1260,8 @@ void ShowTextWindow(bool visible) {
|
|||||||
|
|
||||||
void GetTextWindowSize(int *w, int *h) {
|
void GetTextWindowSize(int *w, int *h) {
|
||||||
Gdk::Rectangle allocation = TW->get_widget().get_allocation();
|
Gdk::Rectangle allocation = TW->get_widget().get_allocation();
|
||||||
*w = allocation.get_width();
|
*w = allocation.get_width() * TW->get_scale_factor();
|
||||||
*h = allocation.get_height();
|
*h = allocation.get_height() * TW->get_scale_factor();
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetScreenDpi() {
|
double GetScreenDpi() {
|
||||||
|
Loading…
Reference in New Issue
Block a user