mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Merge branch 'QHD' of https://github.com/ultimatepp/ultimatepp into QHD
This commit is contained in:
commit
d1990eb90c
10 changed files with 28 additions and 32 deletions
|
|
@ -73,6 +73,9 @@ extern const char *sClipFmtsRTF;
|
|||
|
||||
id menubar;
|
||||
|
||||
double Ctrl::display_scale = 1;
|
||||
double Ctrl::display_unscale = 1;
|
||||
|
||||
void CocoInit(int argc, const char **argv, const char **envptr)
|
||||
{
|
||||
Ctrl::GlobalBackBuffer();
|
||||
|
|
@ -102,16 +105,13 @@ void CocoInit(int argc, const char **argv, const char **envptr)
|
|||
Font::SetFace(0, ToString((CFStringRef)[sysfont familyName]), Font::TTF);
|
||||
|
||||
Ctrl::SetUHDEnabled(true);
|
||||
bool uhd = true;
|
||||
for (NSScreen *screen in [NSScreen screens]) {
|
||||
if([screen backingScaleFactor] < 2) {
|
||||
uhd = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SetUHDMode(uhd);
|
||||
Ctrl::display_scale = 1;
|
||||
for (NSScreen *screen in [NSScreen screens])
|
||||
Ctrl::display_scale = max(Ctrl::display_scale, [screen backingScaleFactor]);
|
||||
|
||||
Ctrl::display_unscale = 1 / Ctrl::display_scale;
|
||||
|
||||
Font::SetDefaultFont(StdFont(fceil(DPI([sysfont pointSize]))));
|
||||
Font::SetDefaultFont(StdFont(fceil(Ctrl::display_scale * [sysfont pointSize])));
|
||||
|
||||
GUI_DblClickTime_Write(1000 * NSEvent.doubleClickInterval);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,12 @@ private:
|
|||
static Ptr<Ctrl> lastActive;
|
||||
|
||||
static bool always_use_bundled_icon;
|
||||
|
||||
static double display_scale;
|
||||
static double display_unscale;
|
||||
|
||||
friend void CocoInit(int argc, const char **argv, const char **envptr);
|
||||
friend void Coco_PaintCh(void *cgcontext, int type, int value, int state);
|
||||
|
||||
protected:
|
||||
virtual void MMClose() {}
|
||||
|
|
@ -33,3 +37,5 @@ public:
|
|||
void RegisterCocoaDropFormats();
|
||||
|
||||
static Rect GetScreenArea(Point pt);
|
||||
static double GetDisplayScale() { return display_scale; }
|
||||
static double GetDisplayUnScale() { return display_unscale; }
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@ void SystemDraw::Init(void *cgContext, void *view)
|
|||
CGContextSetBlendMode(cgHandle, kCGBlendModeNormal);
|
||||
CGContextSetTextPosition(cgHandle, 0, 0);
|
||||
CGContextSetTextDrawingMode(cgHandle, kCGTextFill);
|
||||
if(IsUHDMode())
|
||||
CGContextScaleCTM(cgHandle, 0.5, 0.5);
|
||||
double sc = Ctrl::GetDisplayUnScale();
|
||||
if(sc != 1)
|
||||
CGContextScaleCTM(cgHandle, sc, sc);
|
||||
}
|
||||
|
||||
SystemDraw::SystemDraw(void *cgContext, void *nsview)
|
||||
|
|
|
|||
|
|
@ -329,12 +329,9 @@ void ImageDraw::Init(int cx, int cy)
|
|||
colorSpace, kCGImageAlphaPremultipliedFirst,
|
||||
NULL, NULL), NULL);
|
||||
CGContextTranslateCTM(cgHandle, 0, cy);
|
||||
if(IsUHDMode()) {
|
||||
CGContextScaleCTM(cgHandle, 2, -2);
|
||||
CGContextTranslateCTM(cgHandle, 0, -cy / 2.0);
|
||||
}
|
||||
else
|
||||
CGContextScaleCTM(cgHandle, 1, -1);
|
||||
double sc = Ctrl::GetDisplayScale();
|
||||
CGContextScaleCTM(cgHandle, sc, -sc);
|
||||
CGContextTranslateCTM(cgHandle, 0, -cy / sc);
|
||||
}
|
||||
|
||||
ImageDraw::ImageDraw(Size sz)
|
||||
|
|
|
|||
|
|
@ -112,11 +112,8 @@ inline Upp::Rect MakeRect(const CGRect& r, int dpi) {
|
|||
}
|
||||
|
||||
inline CGRect CGRectDPI(const Upp::Rect& r) {
|
||||
double sc = GetDPIUnScaleRatio();
|
||||
if(Upp::IsUHDMode())
|
||||
return CGRectMake(sc * r.left, sc * r.top, sc * r.GetWidth(), sc * r.GetHeight());
|
||||
else
|
||||
return CGRectMake(r.left, r.top, r.GetWidth(), r.GetHeight());
|
||||
double sc = Upp::GetDPIUnScaleRatio();
|
||||
return CGRectMake(sc * r.left, sc * r.top, sc * r.GetWidth(), sc * r.GetHeight());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -68,12 +68,12 @@ void TopWindow::Init()
|
|||
|
||||
int Ctrl::GetGtkTitleBarHeight(const TopWindow *tw)
|
||||
{
|
||||
return max(tw->custom_titlebar_cy, IsUHDMode() ? 60 : 31);
|
||||
return max(tw->custom_titlebar_cy, DPI(31));
|
||||
}
|
||||
|
||||
int Ctrl::GetGtkTitleBarButtonWidth()
|
||||
{
|
||||
return IsUHDMode() ? 94 : 47;
|
||||
return DPI(47);
|
||||
}
|
||||
|
||||
void TopWindow::SyncIcons()
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@ void Coco_PaintCh(void *cgcontext, int type, int value, int state)
|
|||
{
|
||||
auto dopaint = [&] {
|
||||
auto cg = (CGContextRef) cgcontext;
|
||||
if(Upp::IsUHDMode())
|
||||
CGContextScaleCTM(cg, 2, 2);
|
||||
double sc = Upp::Ctrl::GetDisplayScale();
|
||||
if(sc != 1)
|
||||
CGContextScaleCTM(cg, sc, sc);
|
||||
CGRect cr = CGRectMake(0, 0, 140, 140);
|
||||
if(type == COCO_NSCOLOR) {
|
||||
CGContextSaveGState(cg);
|
||||
|
|
|
|||
|
|
@ -31,11 +31,7 @@ void IconShow::Paint(Draw& w)
|
|||
return DPISmartRescale(image, scale * image.GetSize() / image_scale);
|
||||
};
|
||||
|
||||
Size sz100 = GetSize(DPI_100);
|
||||
Size sz150 = GetSize(DPI_150);
|
||||
Size sz200 = GetSize(DPI_200);
|
||||
Size sz300 = GetSize(DPI_300);
|
||||
|
||||
if(sz300.cx * sz300.cy > 20000) {
|
||||
w.DrawRect(sz, SColorPaper);
|
||||
w.DrawImage(DPI(5), DPI(5), image);
|
||||
|
|
|
|||
|
|
@ -233,7 +233,6 @@ MainConfigDlg::MainConfigDlg(const Workspace& wspc_) : wspc(wspc_) {
|
|||
append.SetImage(IdeImg::add()) << [=] {
|
||||
FlagsDlg cfg;
|
||||
if(cfg.Run() == IDOK) {
|
||||
int q = config.GetCount();
|
||||
cfg.Set(config.Add());
|
||||
LoadList(config.GetCount() - 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
PREMULTIPLIED
|
||||
VERSION(20260403)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue