[Xfce4-commits] [apps/xfce4-screensaver] 01/01: Apply keycap and background classes to fix appearance with Adwaita

noreply at xfce.org noreply at xfce.org
Sat Oct 27 13:15:22 CEST 2018


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screensaver.

commit f8bb2af9af3acf272f9a33e927975ae1a1a86cf4
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sat Oct 27 07:15:15 2018 -0400

    Apply keycap and background classes to fix appearance with Adwaita
---
 .gitignore                       |   1 +
 data/lock-dialog-default.ui      | 406 ++++++++++++++++++++-------------------
 src/Makefile.am                  |  18 ++
 src/xfce4-screensaver-dialog.c   |   9 +-
 src/xfce4-screensaver-dialog.css |   2 +
 5 files changed, 238 insertions(+), 198 deletions(-)

diff --git a/.gitignore b/.gitignore
index d614dfe..0cc514f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,6 +57,7 @@ src/test-window
 src/xfce4-screensaver
 src/xfce4-screensaver-command
 src/xfce4-screensaver-dialog
+src/xfce4-screensaver-dialog-css.h
 src/xfce4-screensaver-gl-helper
 src/xfce4-screensaver-preferences
 src/xfce4-screensaver.desktop.in
diff --git a/data/lock-dialog-default.ui b/data/lock-dialog-default.ui
index fff9cf4..7b14ad8 100644
--- a/data/lock-dialog-default.ui
+++ b/data/lock-dialog-default.ui
@@ -2,105 +2,117 @@
 <!-- Generated with glade 3.22.1 -->
 <interface>
   <requires lib="gtk+" version="3.20"/>
-  <object class="GtkBox" id="lock-dialog">
+  <object class="GtkEventBox" id="lock-dialog">
+    <property name="name">login_window</property>
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="orientation">vertical</property>
     <child>
-      <object class="GtkBox" id="vbox2">
-        <property name="name">login_window</property>
+      <object class="GtkBox">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">6</property>
         <child>
-          <object class="GtkBox" id="content-area">
+          <object class="GtkBox" id="vbox2">
+            <property name="name">login_window</property>
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="margin_left">18</property>
-            <property name="margin_right">18</property>
-            <property name="margin_top">18</property>
             <property name="orientation">vertical</property>
+            <property name="spacing">6</property>
             <child>
-              <object class="GtkBox" id="user-box">
-                <property name="name">content_frame</property>
+              <object class="GtkBox" id="content-area">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">12</property>
-                <child>
-                  <object class="GtkImage" id="auth-face-image">
-                    <property name="name">user_image</property>
-                    <property name="width_request">80</property>
-                    <property name="height_request">80</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="valign">center</property>
-                    <property name="pixel_size">80</property>
-                    <property name="icon_name">avatar-default</property>
-                    <property name="icon_size">6</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
+                <property name="margin_left">18</property>
+                <property name="margin_right">18</property>
+                <property name="margin_top">18</property>
+                <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkBox">
+                  <object class="GtkBox" id="user-box">
+                    <property name="name">content_frame</property>
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="valign">center</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">6</property>
+                    <property name="spacing">12</property>
                     <child>
-                      <object class="GtkLabel" id="auth-realname-label">
+                      <object class="GtkImage" id="auth-face-image">
+                        <property name="name">user_image</property>
+                        <property name="width_request">80</property>
+                        <property name="height_request">80</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="tooltip_text" translatable="yes">%U</property>
-                        <property name="label"><span size="x-large">%R</span></property>
-                        <property name="use_markup">True</property>
-                        <property name="xalign">0</property>
+                        <property name="halign">start</property>
+                        <property name="valign">center</property>
+                        <property name="pixel_size">80</property>
+                        <property name="icon_name">avatar-default</property>
+                        <property name="icon_size">6</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="fill">False</property>
+                        <property name="fill">True</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkBox" id="hbox1">
+                      <object class="GtkBox">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="valign">center</property>
+                        <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
-                          <object class="GtkEntry" id="auth-prompt-entry">
-                            <property name="can_focus">True</property>
-                            <property name="visibility">False</property>
-                            <property name="activates_default">True</property>
-                            <property name="primary_icon_activatable">False</property>
-                            <property name="secondary_icon_activatable">False</property>
-                            <property name="placeholder_text" translatable="yes">Enter your password</property>
-                            <property name="input_purpose">password</property>
+                          <object class="GtkLabel" id="auth-realname-label">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="tooltip_text" translatable="yes">%U</property>
+                            <property name="label"><span size="x-large">%R</span></property>
+                            <property name="use_markup">True</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkBox" id="auth-prompt-kbd-layout-indicator">
+                          <object class="GtkBox" id="hbox1">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <object class="GtkEntry" id="auth-prompt-entry">
+                                <property name="can_focus">True</property>
+                                <property name="visibility">False</property>
+                                <property name="activates_default">True</property>
+                                <property name="primary_icon_activatable">False</property>
+                                <property name="secondary_icon_activatable">False</property>
+                                <property name="placeholder_text" translatable="yes">Enter your password</property>
+                                <property name="input_purpose">password</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
                             <child>
-                              <placeholder/>
+                              <object class="GtkBox" id="auth-prompt-kbd-layout-indicator">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">2</property>
+                              </packing>
                             </child>
                           </object>
                           <packing>
-                            <property name="expand">False</property>
+                            <property name="expand">True</property>
                             <property name="fill">True</property>
-                            <property name="position">2</property>
+                            <property name="position">1</property>
                           </packing>
                         </child>
                       </object>
@@ -112,190 +124,187 @@
                     </child>
                   </object>
                   <packing>
-                    <property name="expand">True</property>
+                    <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">1</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkBox" id="auth-prompt-box">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkLabel" id="status-message-label">
+                  <object class="GtkBox" id="auth-prompt-box">
+                    <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="no_show_all">True</property>
-                    <property name="wrap">True</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkLabel" id="status-message-label">
+                        <property name="can_focus">False</property>
+                        <property name="no_show_all">True</property>
+                        <property name="wrap">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="auth-prompt-label">
+                        <property name="can_focus">False</property>
+                        <property name="no_show_all">True</property>
+                        <property name="xalign">0.5</property>
+                        <property name="yalign">0.5</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="auth-capslock-label">
+                        <property name="can_focus">False</property>
+                        <property name="no_show_all">True</property>
+                        <property name="label" translatable="yes">You have the Caps Lock key on.</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="auth-status-label">
+                        <property name="can_focus">False</property>
+                        <property name="no_show_all">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">True</property>
                     <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="auth-prompt-label">
-                    <property name="can_focus">False</property>
-                    <property name="no_show_all">True</property>
-                    <property name="xalign">0.5</property>
-                    <property name="yalign">0.5</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="auth-capslock-label">
-                    <property name="can_focus">False</property>
-                    <property name="no_show_all">True</property>
-                    <property name="label" translatable="yes">You have the Caps Lock key on.</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
                     <property name="position">2</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkLabel" id="auth-status-label">
-                    <property name="can_focus">False</property>
-                    <property name="no_show_all">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">3</property>
-                  </packing>
-                </child>
               </object>
               <packing>
                 <property name="expand">True</property>
                 <property name="fill">True</property>
-                <property name="position">2</property>
+                <property name="position">0</property>
               </packing>
             </child>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkBox" id="action-buttons">
-            <property name="name">buttonbox_frame</property>
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
             <child>
-              <object class="GtkButtonBox" id="auth-action-area">
+              <object class="GtkBox" id="action-buttons">
+                <property name="name">buttonbox_frame</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="margin_left">12</property>
-                <property name="margin_right">12</property>
-                <property name="margin_bottom">12</property>
-                <property name="spacing">6</property>
-                <property name="layout_style">end</property>
-                <child>
-                  <object class="GtkButton" id="auth-switch-button">
-                    <property name="label" translatable="yes">_Switch User</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="focus_on_click">False</property>
-                    <property name="can_default">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="auth-logout-button">
-                    <property name="label" translatable="yes">_Log Out</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="focus_on_click">False</property>
-                    <property name="can_default">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="auth-cancel-button">
-                    <property name="label" translatable="yes">_Cancel</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="focus_on_click">False</property>
-                    <property name="can_default">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">3</property>
-                  </packing>
-                </child>
+                <property name="orientation">vertical</property>
                 <child>
-                  <object class="GtkButton" id="auth-unlock-button">
-                    <property name="label" translatable="yes">_Unlock</property>
-                    <property name="name">login_button</property>
+                  <object class="GtkButtonBox" id="auth-action-area">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="can_default">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">12</property>
+                    <property name="margin_right">12</property>
+                    <property name="margin_bottom">12</property>
+                    <property name="spacing">6</property>
+                    <property name="layout_style">end</property>
+                    <child>
+                      <object class="GtkButton" id="auth-switch-button">
+                        <property name="label" translatable="yes">_Switch User</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="focus_on_click">False</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="auth-logout-button">
+                        <property name="label" translatable="yes">_Log Out</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="focus_on_click">False</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="auth-cancel-button">
+                        <property name="label" translatable="yes">_Cancel</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="focus_on_click">False</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="auth-unlock-button">
+                        <property name="label" translatable="yes">_Unlock</property>
+                        <property name="name">login_button</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">4</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="expand">False</property>
+                <property name="expand">True</property>
                 <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="position">6</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="expand">True</property>
+            <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">6</property>
+            <property name="position">0</property>
           </packing>
         </child>
       </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">0</property>
-      </packing>
     </child>
     <style>
-      <class name="lightdm-gtk-greeter"/>
+      <class name="background"/>
+      <class name="keycap"/>
     </style>
   </object>
   <object class="GtkOverlay" id="lock-overlay">
+    <property name="name">screen</property>
     <property name="visible">True</property>
     <property name="can_focus">False</property>
     <child>
@@ -308,6 +317,9 @@
         <property name="index">-1</property>
       </packing>
     </child>
+    <style>
+      <class name="lightdm-gtk-greeter"/>
+    </style>
   </object>
   <object class="GtkBox" id="lock-panel">
     <property name="name">panel_window</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index c7b3235..ed90552 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -134,7 +134,11 @@ test_window_LDADD =			\
 	$(SAVER_LIBS)			\
 	$(NULL)
 
+xfce4_screensaver_dialog_built_sources = \
+	xfce4-screensaver-dialog-css.h
+
 xfce4_screensaver_dialog_SOURCES = 	\
+	$(xfce4_screensaver_dialog_built_sources)	\
 	xfce4-screensaver-dialog.c	\
 	gs-lock-plug.c			\
 	gs-lock-plug.h			\
@@ -293,11 +297,25 @@ xfce4_screensaver_preferences_LDADD =	\
 	$(XFCE_SCREENSAVER_CAPPLET_LIBS)	\
 	$(NULL)
 
+if MAINTAINER_MODE
+
+xfce4-screensaver-dialog-css.h: $(srcdir)/xfce4-screensaver-dialog.css Makefile
+	$(AM_V_GEN) exo-csource --static --name=xfce4_screensaver_dialog_css $< >$@
+
+DISTCLEANFILES = \
+	$(xfce4_screensaver_dialog_built_sources)
+
+BUILT_SOURCES += \
+	$(xfce4_screensaver_dialog_built_sources)
+
+endif
+
 EXTRA_DIST =				\
 	debug-screensaver.sh		\
 	gs-marshal.list			\
 	xfcekbd-indicator-marshal.list	\
 	xfce4-screensaver.desktop.in	\
+	xfce4-screensaver-dialog.css	\
 	$(NULL)
 
 GLIB_GENMARSHAL = $(shell pkg-config --variable=glib_genmarshal glib-2.0)
diff --git a/src/xfce4-screensaver-dialog.c b/src/xfce4-screensaver-dialog.c
index 3fa2db4..6111808 100644
--- a/src/xfce4-screensaver-dialog.c
+++ b/src/xfce4-screensaver-dialog.c
@@ -43,6 +43,7 @@
 #include "setuid.h"
 
 #include "gs-debug.h"
+#include "xfce4-screensaver-dialog-css.h"
 
 #include <xfconf/xfconf.h>
 
@@ -394,7 +395,8 @@ static void show_cb(GtkWidget *widget,
 
 static gboolean popup_dialog_idle(void)
 {
-    GtkWidget *widget;
+    GtkWidget      *widget;
+    GtkCssProvider *css_provider;
 
     gs_profile_start(NULL);
 
@@ -427,6 +429,11 @@ static gboolean popup_dialog_idle(void)
     g_signal_connect(GS_LOCK_PLUG(widget), "response", G_CALLBACK(response_cb), NULL);
     g_signal_connect(widget, "show", G_CALLBACK(show_cb), NULL);
 
+    css_provider = gtk_css_provider_new ();
+    gtk_css_provider_load_from_data (css_provider, xfce4_screensaver_dialog_css, xfce4_screensaver_dialog_css_length, NULL);
+    gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), GTK_STYLE_PROVIDER (css_provider),
+                                               GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
     gtk_widget_realize(widget);
 
     g_idle_add((GSourceFunc) auth_check_idle, widget);
diff --git a/src/xfce4-screensaver-dialog.css b/src/xfce4-screensaver-dialog.css
new file mode 100644
index 0000000..9c55467
--- /dev/null
+++ b/src/xfce4-screensaver-dialog.css
@@ -0,0 +1,2 @@
+/* Workaround for Adwaita - and other themes - setting a smaller font for the keycap window */
+#login_window.keycap { font-size: initial; }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list