[gnome-builder/wip/gtk4-port: 1121/1774] plugins/omni-gutter: use line-background for breakpoints
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 1121/1774] plugins/omni-gutter: use line-background for breakpoints
- Date: Mon, 11 Jul 2022 22:31:35 +0000 (UTC)
commit 3b58958b43f6299784086de58a02ec82aef69c8e
Author: Christian Hergert <chergert redhat com>
Date: Mon May 23 13:47:16 2022 -0700
plugins/omni-gutter: use line-background for breakpoints
data/style-schemes/builder-dark.xml | 4 +--
data/style-schemes/builder.xml | 4 ++-
src/plugins/omni-gutter/gbp-omni-gutter-renderer.c | 34 ++++++++++++++++++----
3 files changed, 33 insertions(+), 9 deletions(-)
---
diff --git a/data/style-schemes/builder-dark.xml b/data/style-schemes/builder-dark.xml
index e358a840a..27720645a 100644
--- a/data/style-schemes/builder-dark.xml
+++ b/data/style-schemes/builder-dark.xml
@@ -89,8 +89,8 @@
<style name="-Builder:error" underline="error" underline-color="red1"/>
<style name="-Builder:note" underline="error" underline-color="skyblue1"/>
<style name="-Builder:warning" underline="error" underline-color="orange1"/>
- <style name="-Builder:current-breakpoint" foreground="#2e3436" background="#fcaf3e"/>
- <style name="-Builder:breakpoint" foreground="#ffffff" background="#204a87"/>
+ <style name="-Builder:current-breakpoint" foreground="#2e3436" line-background="#fcaf3e"/>
+ <style name="-Builder:breakpoint" foreground="#ffffff" line-background="#204a87"/>
<style name="-Builder:hover-definition" background="#41464c" underline="true"/>
<style name="-Builder:label" foreground="#000000" background="#D5E7FC"/>
<style name="-Builder:id" foreground="#000000" background="#D9E7BD"/>
diff --git a/data/style-schemes/builder.xml b/data/style-schemes/builder.xml
index 0da58863c..702c792b9 100644
--- a/data/style-schemes/builder.xml
+++ b/data/style-schemes/builder.xml
@@ -71,6 +71,7 @@
<color name="skyblue3" value="#204A87"/>
<color name="text1" value="#4D4E53"/>
<color name="white" value="#FFFFFF"/>
+ <color name="black" value="#000000"/>
<color name="yellow1" value="#FFF9E5"/>
<!-- Global Styles -->
@@ -97,7 +98,8 @@
<style name="-Builder:added-line" foreground="chameleon1"/>
<style name="-Builder:changed-line" foreground="orange1"/>
<style name="-Builder:removed-line" foreground="scarletred1"/>
- <style name="-Builder:breakpoint" background="#4A90D9" foreground="white"/>
+ <style name="-Builder:current-breakpoint" line-background="#f5c211" foreground="black"/>
+ <style name="-Builder:breakpoint" line-background="#4A90D9" foreground="white"/>
<style name="-Builder:deprecated" underline="error" underline-color="aluminium3"/>
<style name="-Builder:error" underline="error" underline-color="red1"/>
<style name="-Builder:note" underline="error" underline-color="blue1"/>
diff --git a/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
b/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
index 87d795560..eb9e1452b 100644
--- a/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
+++ b/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
@@ -182,6 +182,7 @@ struct _GbpOmniGutterRenderer
enum {
FOREGROUND,
BACKGROUND,
+ LINE_BACKGROUND,
};
enum {
@@ -397,7 +398,7 @@ style_get_is_bold (GtkSourceStyleScheme *scheme,
*
* Gets a #GdkRGBA for a particular field of a style within @scheme.
*
- * @type should be set to BACKGROUND or FOREGROUND.
+ * @type should be set to BACKGROUND or FOREGROUND or LINE_BACKGROUND.
*
* If we fail to locate the style, @rgba is set to transparent black.
* such as #rgba(0,0,0,0).
@@ -417,7 +418,7 @@ get_style_rgba (GtkSourceStyleScheme *scheme,
g_assert (!scheme || GTK_SOURCE_IS_STYLE_SCHEME (scheme));
g_assert (style_name != NULL);
- g_assert (type == FOREGROUND || type == BACKGROUND);
+ g_assert (type == FOREGROUND || type == BACKGROUND || type == LINE_BACKGROUND);
g_assert (rgba != NULL);
memset (rgba, 0, sizeof *rgba);
@@ -438,12 +439,33 @@ get_style_rgba (GtkSourceStyleScheme *scheme,
if (style != NULL)
{
+ const char *name;
+ const char *name_set;
g_autofree gchar *str = NULL;
gboolean set = FALSE;
+ switch (type)
+ {
+ default:
+ case FOREGROUND:
+ name = "foreground";
+ name_set = "foreground-set";
+ break;
+
+ case BACKGROUND:
+ name = "background";
+ name_set = "background-set";
+ break;
+
+ case LINE_BACKGROUND:
+ name = "line-background";
+ name_set = "line-background-set";
+ break;
+ }
+
g_object_get (style,
- type ? "background" : "foreground", &str,
- type ? "background-set" : "foreground-set", &set,
+ name, &str,
+ name_set, &set,
NULL);
if (str != NULL)
@@ -552,14 +574,14 @@ reload_style_colors (GbpOmniGutterRenderer *self,
* as well as in the IdeBuffer class. Other style schemes may also
* support them, though.
*/
- if (!get_style_rgba (scheme, "-Builder:current-breakpoint", BACKGROUND, &self->stopped_bg))
+ if (!get_style_rgba (scheme, "-Builder:current-breakpoint", LINE_BACKGROUND, &self->stopped_bg))
gdk_rgba_parse (&self->stopped_bg, IDE_LINE_CHANGES_FALLBACK_CHANGED);
if (!get_style_rgba (scheme, "-Builder:breakpoint", FOREGROUND, &self->bkpt.fg) &&
!get_style_rgba (scheme, "selection", FOREGROUND, &self->bkpt.fg))
self->bkpt.fg = fg;
- if (!get_style_rgba (scheme, "-Builder:breakpoint", BACKGROUND, &self->bkpt.bg) &&
+ if (!get_style_rgba (scheme, "-Builder:breakpoint", LINE_BACKGROUND, &self->bkpt.bg) &&
!get_style_rgba (scheme, "selection", BACKGROUND, &self->bkpt.bg))
{
gdk_rgba_parse (&self->bkpt.bg, "#1c71d8");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]