Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spinboxes #162

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib/adwaitarenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ void Renderer::renderMenuFrame(const StyleOptions &options, bool roundCorners)
options.painter()->restore();
}

void Renderer::renderButtonFrame(const StyleOptions &options)
void Renderer::renderButtonFrame(const StyleOptions &options, bool renderBevel)
{
if (!options.painter()) {
return;
Expand Down Expand Up @@ -430,8 +430,8 @@ void Renderer::renderButtonFrame(const StyleOptions &options)

// render
options.painter()->drawRoundedRect(frameRect, radius, radius);

if (!options.sunken() && options.active() && options.color().isValid()) {
// gtk4 adwaita looks flat these days, so we wont draw the extra decor by default
if (!options.sunken() && options.active() && options.color().isValid() && renderBevel) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to have current Adwaita-qt GTK3 based and possible do a major GTK4 overhaul in the future.

Copy link
Author

@AlexB67 AlexB67 Jan 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do a new new style altogether for gtk4 and leave the gtk3 one as is ? .Anyway, libadwaita has just been released, and things are a bit different again. Perhaps it should be inspired by that.

options.painter()->setPen(options.color().lighter(140));
options.painter()->drawLine(frameRect.topLeft() + QPoint(3, 1), frameRect.topRight() + QPoint(-3, 1));
options.painter()->setPen(options.outlineColor().darker(114));
Expand Down
2 changes: 1 addition & 1 deletion src/lib/adwaitarenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ADWAITAQT_EXPORT Renderer

static void renderMenuFrame(const StyleOptions &options, bool roundCorners = true);

static void renderButtonFrame(const StyleOptions &options);
static void renderButtonFrame(const StyleOptions &options, bool renderBevel = false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not ABI compatible change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wasn't suggesting you should incorporate it. It was a suggestion for a an improved look with a minimal change. so you can see the result. (much better IMO)


static void renderCheckBoxFrame(const StyleOptions &options);

Expand Down
2 changes: 1 addition & 1 deletion src/lib/stylesheet/processed/Adwaita-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
@define-color focus_border_color rgba(21, 83, 158, 0.7);
@define-color alt_focus_border_color rgba(255, 255, 255, 0.3);
@define-color dim_label_opacity 0.55;
button { color: #eeeeec; outline-color: rgba(21, 83, 158, 0.7); border-color: #1b1b1b; background-image: linear-gradient(to top, #373737 2px, #3a3a3a); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07); }
button { color: #eeeeec; outline-color: rgba(21, 83, 158, 0.7); border-color: #1b1b1b; background-image: image(#393939); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07); }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to have current Adwaita-qt GTK3 based and possible do a major GTK4 overhaul in the future.


button:hover { color: #eeeeec; border-color: #1b1b1b; background-image: linear-gradient(to top, #303030 20%, #323232 90%); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07); }

Expand Down
4 changes: 3 additions & 1 deletion src/style/adwaitahelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
#include <QLibrary>

#if ADWAITA_HAVE_X11
#include <X11/Xlib-xcb.h>
//#include <X11/Xlib-xcb.h>
// POP_OS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes irrelevant, it was just temporary otherwise compilation fails on POP.

#include <xcb/xcb.h>
#endif

namespace Adwaita
Expand Down
11 changes: 7 additions & 4 deletions src/style/adwaitastyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2771,14 +2771,15 @@ QSize Style::spinBoxSizeFromContents(const QStyleOption *option, const QSize &co
// add editor margins
int frameWidth(pixelMetric(PM_SpinBoxFrameWidth, option, widget));
if (!flat) {
size = expandSize(size, frameWidth);
size = expandSize(size, frameWidth, 0);
}

size.rwidth() += 2 * Metrics::SpinBox_MinHeight;
size.rwidth() += Metrics::Button_ItemSpacing;

// FIXME this shouldn't be needed but apparently some width is still missing
size.rwidth() += size.height() / 2;
// reduce to 1 / 4 sems enough, was 1 / 2
size.rwidth() += size.height() / 4;

// set minimum size
size.setHeight(qMax(size.height(), int(Metrics::SpinBox_MinHeight)));
Expand Down Expand Up @@ -3361,7 +3362,7 @@ bool Style::drawFrameFocusRectPrimitive(const QStyleOption *option, QPainter *pa
}

QColor outlineColor(Colors::mix(palette.color(QPalette::Window), palette.color(QPalette::WindowText), 0.35));
QPen pen(outlineColor, 1);
QPen pen(outlineColor, 0.5);
pen.setStyle(Qt::CustomDashLine);
pen.setDashPattern(QVector<qreal>() << 2 << 1);

Expand Down Expand Up @@ -6751,7 +6752,9 @@ bool Style::drawSliderComplexControl(const QStyleOptionComplex *option, QPainter
StyleOptions styleOptions(palette, _variant);

// colors
QColor base(Colors::separatorColor(styleOptions));
// QColor base(Colors::separatorColor(styleOptions));
// Fix black slider ticks for dark variant
QColor base(Colors::transparentize(palette.text().color(), 0.5));

while (current <= sliderOption->maximum) {
// adjust color
Expand Down