The XCDE way of doing this is to query color sets from the color server using X selections (dtsession is acting as color server on CDE). That's what Motif does.

I don't think it is necessary to add any code to dtsession or anywhere in CDE at all to achieve this. A separate utility that sits between CDE's color server and GTK, Qt, you name it... would be a much cleaner way to implement this.

As an example for matching CDE's color sets to GTK widgets I have this hackish Kornshell script that generates .gtkrc scripts from CDE palettes for me :) I attached it in case you're interested.

On 06/24/15 16:36, Antonis Tsolomitis wrote:

On 24/06/2015 05:22 μμ, Marcin Cieslak wrote:
The actual problem is probably how to match those few colors onto vast
array of GTK widgets.


Well, you are right. But couldn't we start from what is needed by
standard and big desktop apps?

It does not seem that Firefox, LibreOffice, Thunderbird and Gimp need
all possibilities that GTK provides.

Antonis.


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors
network devices and physical & virtual servers, alerts via email & sms
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel



#!/usr/local/bin/ksh93
#------------------------------------------------------------------------------
# Generates gtkrc from CDE session settings.
#
# Depending on 'Resume current session' setting in Startup settings dialog,
# color palette from current or home session will be used. It can also be
# overriden with -s <session> parameter. A file named gtkrc-2.0-new will be
# written to user's home directory. If -o is specified ~/.gtkrc-2.0 will be
# overwritten.
#
# Issues:
#       GTK2 doesn't understand X logical font descriptors, so the font
#       must be specified manually with '-f <font name>' switch.
#
#       It is assumed that 'thinice' engine is installed (for most distributions
#       it's a part of GTK2 package).
#
#       Some options, like toolbar icon size, cursor blinkrate and popup delay
#       are hardcoded here to relatively usable values.
#------------------------------------------------------------------------------

DT_INST_DIR=/usr/dt
DT_USER_DIR="$HOME/.dt"
GTKRC="$HOME/gtkrc-2.0-new"
FONT="Helvetica 10"

if [ -d "$DT_USER_DIR/sessions/current" ]; then
        SESS_DIR="$DT_USER_DIR/sessions/current"
else
        SESS_DIR="$DT_USER_DIR/sessions/home"
fi

until [[ "$#" -eq 0 ]]; do
        case "$1" in
                -o)
                GTKRC="$HOME/.gtkrc-2.0"
                ;;
                -s)
                SESS_DIR="$DT_USER_DIR/sessions/$2"
                ;;
                -f)
                FONT="$2"
                ;;
                --help|-h)
                echo 'usage: dtgtkrcgen [ -o -s <session> -f <font> ]'
                exit 0
        esac
        shift
done

DT_RESOURCES="$SESS_DIR/dt.resources"
# Since GTK2 doesn't understand XLFDs we can't use system font alias here
# FONT=$( grep "systemFont:" $DT_RESOURCES | sed "s/*systemFont:[ 
\t]\(.*\)/\1/" | tr -d : )

BK_COLOR=$( grep "background:" $DT_RESOURCES | awk '{ print $2 };' )
FG_COLOR=$( grep "foreground:" $DT_RESOURCES | awk '{ print $2 };' )
PALETTE=$( grep "ColorPalette:" $DT_RESOURCES | awk '{ print $2 };' )

# Pick system or user's color palette file
if [ -f "$DT_USER_DIR/palettes/$PALETTE" ]; then
        PALETTE="$DT_USER_DIR/palettes/$PALETTE"
else
        PALETTE="$DT_INST_DIR/palettes/$PALETTE"
fi

i=0
for ent in $(cat $PALETTE); do
        PAL_COLOR[i]="$ent"
        i=$(expr "$i + 1")
done

cat > "$GTKRC" << END
# This file was generated by gtkrcgen using:
# session "$DT_RESOURCES"
# palette "$PALETTE"

gtk-icon-sizes="gtk-large-toolbar=16,16:gtk-small-toolbar=16,16:panel-menu=16,16:gtk-button=16,16"
gtk-button-images=0 
gtk-menu-popup-delay=100
gtk-cursor-blink-time=500
gtk-menu-images=0
gtk-font-name="$FONT"

style "all" {
engine "thinice" {
mark_type1=NOTHING
mark_type2=ARROW
}
fg[NORMAL]="$FG_COLOR"
fg[PRELIGHT]="$FG_COLOR"
fg[SELECTED]="$FG_COLOR"
fg[ACTIVE]="$FG_COLOR"
fg[INSENSITIVE]=darker ("$BK_COLOR")
bg[NORMAL]="$BK_COLOR"
bg[PRELIGHT]="$BK_COLOR"
bg[SELECTED]=shade (1.20, "$BK_COLOR")
bg[INSENSITIVE]="$BK_COLOR"
bg[ACTIVE]="$BK_COLOR"
base[NORMAL]="${PAL_COLOR[3]}"
base[PRELIGHT]="${PAL_COLOR[3]}"
base[ACTIVE]="${PAL_COLOR[3]}"
base[SELECTED]="${PAL_COLOR[0]}"
base[INSENSITIVE]=darker ("${PAL_COLOR[3]}")
text[NORMAL]="$FG_COLOR"
text[PRELIGHT]="$FG_COLOR"
text[ACTIVE]="$FG_COLOR"
text[SELECTED]="${PAL_COLOR[3]}"
text[INSENSITIVE]=darker ("$BK_COLOR")
GtkMenuItem::selected-shadow-type=GTK_SHADOW_IN
}

style "menubar" {
fg[INSENSITIVE]=darker ("$BK_COLOR")
bg[PRELIGHT]=shade (0.90, "$BK_COLOR")
bg[SELECTED]=shade (0.90, "$BK_COLOR")
}

style "menu" {
fg[INSENSITIVE]=darker ("$BK_COLOR")
bg[PRELIGHT]=shade (0.90, "$BK_COLOR")
bg[SELECTED]=shade (0.90, "$BK_COLOR")
}

style "entry" {
base[NORMAL]="${PAL_COLOR[3]}"
base[PRELIGHT]="${PAL_COLOR[3]}"
base[ACTIVE]="${PAL_COLOR[3]}"
base[INSENSITIVE]="$BK_COLOR"
}

style "checkbuttons" {
bg[ACTIVE]="${PAL_COLOR[0]}"
}

style "progressbar" {
bg[PRELIGHT] = "${PAL_COLOR[0]}"
}

style "tooltip" {
bg[NORMAL]="${PAL_COLOR[3]}"    
}

widget_class "*" style "all"
widget_class "*GtkMenu*" style "menu"
widget_class "*GtkMenuBar*" style "menubar"
widget "*GtkEntry" style "entry"
widget "*GtkSpinButton" style "entry"
widget "*GtkTextView" style "entry"
widget "*GtkTreeView" style "entry"
widget "*GtkProgressBar" style "progressbar"
widget "*GtkCheckButton" style "checkbuttons"
widget "*GtkRadioButton" style "checkbuttons"
widget "*GtkCheckMenuItem" style "checkbuttons"
widget "*GtkRadioMenuItem" style "checkbuttons"
widget "gtk-tooltip*" style "tooltip"
END
------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to