Bug #665

EditField::Style dosen't work property on some Qt(KDE) distributions (ChGTK)

Added by Zbigniew Rebacz over 7 years ago. Updated over 7 years ago.

Status:ApprovedStart date:01/26/2014
Priority:NormalDue date:
Assignee:Zbigniew Rebacz% Done:

0%

Category:CtrlLibSpent time:-
Target version:-

Description

Nasty and hard to diagnose bug. So, what is the problem? On Qt platform such as KDE ChGtk has got problem to choose proper EditField frame. This bug may manifest as a complete lack of frame (Look: oxygen-gtk theme).

Following code should stabilize drawing EditField frame on Qt platform(KDE):

    int efm = 0;
    {
        EditField::Style& s = EditField::StyleDefault().Write();
        Image img;
        for(int i = 0; i < 4; i++) {
            GtkWidget *w = Setup(gtk_entry_new());
            if(i == CTRL_PRESSED)
                GTK_WIDGET_FLAGS (w) |= GTK_HAS_FOCUS;
            if(i == CTRL_DISABLED)
                GTK_WIDGET_FLAGS (w) &= GTK_SENSITIVE;
            img = GetGTK(w, GTK_STATE_NORMAL, GTK_SHADOW_IN, "entry", GTK_SHADOW, 20, 20);
            if(i == 0)
                efm = max(ImageMargin(img, 4, 0), 1);
            if(!Qt) 
                img = GetGTK(w, GTK_STATE_NORMAL, GTK_SHADOW_IN,
                        "entry", GTK_SHADOW, 2 * efm + 3, 2 * efm + 3); // <- It seems that this line causing problems on Qt for some resons!!!
            ImageBuffer eb(img);
            eb.SetHotSpot(Point(efm, efm));
            s.edge[i] = Image(eb);
            s.activeedge = true;
            gtk_widget_destroy(w);
        }
    }

Above code was tested on Ubuntu(Gtk - Nothing has changed) and Kubuntu(KDE). On KDE I had tested on multiple themes.

P.S.
This patch includes all my previous patches to ChGtk.cpp.

ChGtk.cpp Magnifier (21.2 KB) Zbigniew Rebacz, 01/31/2014 01:09 AM

History

#1 Updated by Miroslav Fidler over 7 years ago

  • Status changed from Patch ready to Approved

#2 Updated by Zbigniew Rebacz over 7 years ago

  • Status changed from Approved to Patch ready

Hello Mirek,

You should also move "img = GetGTK(w, GTK_STATE_NORMAL, GTK_SHADOW_IN, "entry", GTK_SHADOW, 20, 20);" out of if block(if (i == 0)) (Line 11 on my above post). I would like to notice that current code on SVN dosen't work correctly on KDE for 99.9%.

For more details please diff ChGtk0.cpp included in this topic.

#3 Updated by Miroslav Fidler over 7 years ago

  • Status changed from Patch ready to In Progress
  • Assignee changed from Miroslav Fidler to Zbigniew Rebacz

Zbigniew Rebacz wrote:

Hello Mirek,

You should also move "img = GetGTK(w, GTK_STATE_NORMAL, GTK_SHADOW_IN, "entry", GTK_SHADOW, 20, 20);" out of if block(if (i == 0)) (Line 11 on my above post). I would like to notice that current code on SVN dosen't work correctly on KDE for 99.9%.

For more details please diff ChGtk0.cpp included in this topic.

Well, that is the problem: You have posted ChGtk0.cpp instead of ChGtk.cpp ;)

#4 Updated by Zbigniew Rebacz over 7 years ago

  • File deleted (ChGtk0.cpp)

#5 Updated by Zbigniew Rebacz over 7 years ago

  • File ChGtk.cpp added
  • Assignee changed from Zbigniew Rebacz to Miroslav Fidler

The correct file...

#6 Updated by Zbigniew Rebacz over 7 years ago

  • Status changed from In Progress to Patch ready

#7 Updated by Zbigniew Rebacz over 7 years ago

  • File deleted (ChGtk.cpp)

#8 Updated by Zbigniew Rebacz over 7 years ago

  • Additional menubar fix on pure gtk distributions.

#9 Updated by Miroslav Fidler over 7 years ago

  • Status changed from Patch ready to Approved
  • Assignee changed from Miroslav Fidler to Zbigniew Rebacz

Also available in: Atom PDF