View Issue Details

IDProjectCategoryView StatusLast Update
0033536PatchesLCLpublic2020-05-17 15:51
ReporterYuriy Kopnin Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionreopened 
PlatformLinux GTK+ 2OSLinux GTK+ 2 
Summary0033536: TGtk2ThemeServices not correctly draws TToolButton
DescriptionTGtk2ThemeServices not correctly draws TToolButton.
The drawing of buttons doesn't correspond to the themes GTK.

I have corrected 2 strings in the file 'GTK2Themes.pas'
Correction in attach
TagsNo tags attached.
Fixed in Revisionr57583
LazTarget-
WidgetsetGTK 2
Attached Files

Relationships

related to 0034010 resolvedJuha Manninen Lazarus TSpeedButton.Flat does not function correctly on GTK2 anymore 

Activities

Yuriy Kopnin

2018-03-30 18:34

reporter  

Lazarus.Gtk2Themes.txt (2,509 bytes)   
function TGtk2ThemeServices.GetGtkStyleParams(DC: HDC;
  Details: TThemedElementDetails; AIndex: Integer): TGtkStyleParams;
        
      
      teToolBar:
      begin
        case Details.Part of
          TP_BUTTON,
          TP_DROPDOWNBUTTON,
          TP_SPLITBUTTON,
          TP_SPLITBUTTONDROPDOWN:
            begin
              Result.Widget := GetStyleWidget(lgsToolButton);
              case Details.State of
                TS_PRESSED, TS_CHECKED, TS_HOTCHECKED:
                  Result.Shadow := GTK_SHADOW_IN;
                TS_HOT:
                  Result.Shadow := GTK_SHADOW_OUT;                           // << Yuriy Kopnin
		  //Result.Shadow := GTK_SHADOW_ETCHED_OUT;                  // << Yuriy Kopnin 
              else
                Result.Shadow := GTK_SHADOW_NONE;
              end;
              if Details.Part = TP_SPLITBUTTONDROPDOWN then
              begin
                case Details.State of
                  TS_DISABLED: Result.State := GTK_STATE_INSENSITIVE;
                  //TS_HOT: Result.State := GTK_STATE_ACTIVE; // << painting bug in Laz+Gtk2
                else
                  Result.State := GTK_STATE_NORMAL;
                end;
              end else
                Result.State := GtkButtonMap[Details.State];

              Result.IsHot := Details.State in [TS_HOT, TS_HOTCHECKED];
              //if Result.Style = nil then                                   // << Yuriy Kopnin
                  Result.Style := GetStyle(lgsToolButton);

              if (Details.Part = TP_SPLITBUTTONDROPDOWN) then
              begin
                Result.Detail := 'arrow';
                Result.ArrowType := GTK_ARROW_DOWN;
                Result.Fill := True;
                Result.Painter := gptArrow;
                Result.MaxWidth := 10;
              end
              else
              begin
                Result.Detail := 'button';
                if Result.Shadow = GTK_SHADOW_NONE then
                  Result.Painter := gptNone
                else
                  Result.Painter := gptBox;
              end;
            end;
          TP_SEPARATOR,
          TP_SEPARATORVERT:
            begin
              Result.State := GTK_STATE_NORMAL;
              Result.Shadow := GTK_SHADOW_NONE;
              Result.Detail := 'toolbar';
              if Details.Part = TP_SEPARATOR then
                Result.Painter := gptVLine
              else
                Result.Painter := gptHLine;
            end;
        end;
      end;
Lazarus.Gtk2Themes.txt (2,509 bytes)   

Vojtech Cihak

2018-03-30 18:55

reporter   ~0107469

Use "svn diff" for the patch, see http://wiki.freepascal.org/Creating_A_Patch#Creating_a_patch_using_SVN

Yuriy Kopnin

2018-03-31 08:31

reporter  

gtk2themes.diff (1,298 bytes)   
Index: gtk2themes.pas
===================================================================
--- gtk2themes.pas	(revision 57579)
+++ gtk2themes.pas	(working copy)
@@ -375,7 +375,7 @@
                 TS_PRESSED, TS_CHECKED, TS_HOTCHECKED:
                   Result.Shadow := GTK_SHADOW_IN;
                 TS_HOT:
-                  Result.Shadow := GTK_SHADOW_ETCHED_OUT;
+                  Result.Shadow := GTK_SHADOW_OUT;
               else
                 Result.Shadow := GTK_SHADOW_NONE;
               end;
@@ -383,7 +383,6 @@
               begin
                 case Details.State of
                   TS_DISABLED: Result.State := GTK_STATE_INSENSITIVE;
-                  //TS_HOT: Result.State := GTK_STATE_ACTIVE; // << painting bug in Laz+Gtk2
                 else
                   Result.State := GTK_STATE_NORMAL;
                 end;
@@ -391,8 +390,8 @@
                 Result.State := GtkButtonMap[Details.State];
 
               Result.IsHot := Details.State in [TS_HOT, TS_HOTCHECKED];
-              if Result.Style = nil then
-                Result.Style := GetStyle(lgsToolButton);
+              Result.Style := GetStyle(lgsToolButton);
+
               if (Details.Part = TP_SPLITBUTTONDROPDOWN) then
               begin
                 Result.Detail := 'arrow';
gtk2themes.diff (1,298 bytes)   

Yuriy Kopnin

2018-03-31 08:32

reporter   ~0107472

Last edited: 2018-03-31 09:08

View 2 revisions

upload gtk2themes-2.diff

Yuriy Kopnin

2018-03-31 09:01

reporter  

gtk2themes-2.diff (1,294 bytes)   
Index: gtk2themes.pas
===================================================================
--- gtk2themes.pas	(revision 57579)
+++ gtk2themes.pas	(working copy)
@@ -375,7 +375,7 @@
                 TS_PRESSED, TS_CHECKED, TS_HOTCHECKED:
                   Result.Shadow := GTK_SHADOW_IN;
                 TS_HOT:
-                  Result.Shadow := GTK_SHADOW_ETCHED_OUT;
+                  Result.Shadow := GTK_SHADOW_OUT;
               else
                 Result.Shadow := GTK_SHADOW_NONE;
               end;
@@ -383,7 +383,6 @@
               begin
                 case Details.State of
                   TS_DISABLED: Result.State := GTK_STATE_INSENSITIVE;
-                  //TS_HOT: Result.State := GTK_STATE_ACTIVE; // << painting bug in Laz+Gtk2
                 else
                   Result.State := GTK_STATE_NORMAL;
                 end;
@@ -391,8 +390,8 @@
                 Result.State := GtkButtonMap[Details.State];
 
               Result.IsHot := Details.State in [TS_HOT, TS_HOTCHECKED];
-              if Result.Style = nil then
-                Result.Style := GetStyle(lgsToolButton);
+              Result.Style := GetStyle(lgsButton);
+
               if (Details.Part = TP_SPLITBUTTONDROPDOWN) then
               begin
                 Result.Detail := 'arrow';
gtk2themes-2.diff (1,294 bytes)   

Juha Manninen

2018-03-31 16:19

developer   ~0107483

Applied, thanks.
A minor thing: The patch would be even better if you make it from the top directory of Lazarus sources. Then it can also be applied from the top directory.

Juha Manninen

2018-07-21 23:20

developer   ~0109611

Last edited: 2018-07-21 23:25

View 2 revisions

I reverted r57583 in r58588 because it caused a regression. Please see the related issue.
Yuriy Kopnin, can you fix it?

Juha Manninen

2018-11-23 13:01

developer   ~0112132

Ping

Juha Manninen

2020-05-17 15:51

developer   ~0122880

No feedback. Detaching myself.

Issue History

Date Modified Username Field Change
2018-03-30 18:34 Yuriy Kopnin New Issue
2018-03-30 18:34 Yuriy Kopnin File Added: Lazarus.Gtk2Themes.txt
2018-03-30 18:55 Vojtech Cihak Note Added: 0107469
2018-03-31 08:31 Yuriy Kopnin File Added: gtk2themes.diff
2018-03-31 08:32 Yuriy Kopnin Note Added: 0107472
2018-03-31 09:01 Yuriy Kopnin File Added: gtk2themes-2.diff
2018-03-31 09:08 Yuriy Kopnin Note Edited: 0107472 View Revisions
2018-03-31 16:11 Juha Manninen Assigned To => Juha Manninen
2018-03-31 16:11 Juha Manninen Status new => assigned
2018-03-31 16:19 Juha Manninen Fixed in Revision => r57583
2018-03-31 16:19 Juha Manninen LazTarget => -
2018-03-31 16:19 Juha Manninen Note Added: 0107483
2018-03-31 16:19 Juha Manninen Status assigned => resolved
2018-03-31 16:19 Juha Manninen Resolution open => fixed
2018-07-20 18:50 Michl Relationship added related to 0034010
2018-07-21 23:20 Juha Manninen Note Added: 0109611
2018-07-21 23:20 Juha Manninen Status resolved => assigned
2018-07-21 23:20 Juha Manninen Resolution fixed => reopened
2018-07-21 23:25 Juha Manninen Note Edited: 0109611 View Revisions
2018-09-13 12:41 Juha Manninen Status assigned => feedback
2018-11-23 13:01 Juha Manninen Note Added: 0112132
2020-05-17 15:51 Juha Manninen Assigned To Juha Manninen =>
2020-05-17 15:51 Juha Manninen Status feedback => new
2020-05-17 15:51 Juha Manninen Note Added: 0122880