Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gtk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1,150
Issues
1,150
List
Boards
Labels
Service Desk
Milestones
Merge Requests
141
Merge Requests
141
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
gtk
Commits
2af224b3
Commit
2af224b3
authored
Oct 03, 2003
by
cinamod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redo how we do styles
parent
0f5490e5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
58 deletions
+75
-58
modules/engines/ms-windows/ChangeLog.old
modules/engines/ms-windows/ChangeLog.old
+4
-0
modules/engines/ms-windows/wimp_style.c
modules/engines/ms-windows/wimp_style.c
+68
-58
modules/engines/ms-windows/wimp_style.h
modules/engines/ms-windows/wimp_style.h
+1
-0
modules/engines/ms-windows/wimp_theme_main.c
modules/engines/ms-windows/wimp_theme_main.c
+2
-0
No files found.
modules/engines/ms-windows/ChangeLog.old
View file @
2af224b3
2003-10-03 Dom Lachowicz <cinamod@hotmail.com>
* src/wimp_style.c wimp_style_main.c: Refactor how we're doing styles. Much faster, lower memory consumption
2003-10-03 Dom Lachowicz <cinamod@hotmail.com>
* src/wimp_style_main.c: Catch theme and color changes. Needs more testing and fine-tuning
...
...
modules/engines/ms-windows/wimp_style.c
View file @
2af224b3
...
...
@@ -219,7 +219,7 @@ sys_font_to_pango_font (SystemFontType type, char * buf)
#endif
static
void
setup_system_settings
(
GtkStyle
*
style
)
setup_system_settings
(
void
)
{
GtkSettings
*
settings
;
int
menu_delay
,
cursor_blink_time
;
...
...
@@ -316,53 +316,28 @@ sys_color_to_gtk_color(int id, GdkColor *pcolor)
}
static
void
setup_
system_styles
(
GtkStyle
*
style
)
setup_
wimp_rc_style
(
void
)
{
/* TODO: Owen says:
"If your setup_system_styles() function called gtk_rc_parse_string(), then you are just piling a new set of strings on top each time the theme changes .. the old ones won't be removed" */
char
buf
[
1024
],
font_buf
[
256
],
*
font_ptr
;
GdkColor
menu_color
;
GdkColor
menu_text_color
;
GdkColor
fg_prelight
;
GdkColor
bg_prelight
;
GdkColor
base_prelight
;
GdkColor
text_prelight
;
GdkColor
tooltip_back
;
GdkColor
tooltip_fore
;
GdkColor
btn_fore
;
GdkColor
progress_back
;
GdkColor
fg_prelight
;
GdkColor
bg_prelight
;
GdkColor
base_prelight
;
GdkColor
text_prelight
;
NONCLIENTMETRICS
nc
;
gint
paned_size
=
15
;
int
i
;
/* Default forgeground */
sys_color_to_gtk_color
(
COLOR_WINDOWTEXT
,
&
style
->
fg
[
GTK_STATE_NORMAL
]);
sys_color_to_gtk_color
(
COLOR_WINDOWTEXT
,
&
style
->
fg
[
GTK_STATE_ACTIVE
]);
sys_color_to_gtk_color
(
COLOR_WINDOWTEXT
,
&
style
->
fg
[
GTK_STATE_PRELIGHT
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHTTEXT
,
&
style
->
fg
[
GTK_STATE_SELECTED
]);
sys_color_to_gtk_color
(
COLOR_GRAYTEXT
,
&
style
->
fg
[
GTK_STATE_INSENSITIVE
]);
/* Default background */
sys_color_to_gtk_color
(
COLOR_3DFACE
,
&
style
->
bg
[
GTK_STATE_NORMAL
]);
sys_color_to_gtk_color
(
COLOR_SCROLLBAR
,
&
style
->
bg
[
GTK_STATE_ACTIVE
]);
sys_color_to_gtk_color
(
COLOR_3DFACE
,
&
style
->
bg
[
GTK_STATE_PRELIGHT
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHT
,
&
style
->
bg
[
GTK_STATE_SELECTED
]);
sys_color_to_gtk_color
(
COLOR_3DFACE
,
&
style
->
bg
[
GTK_STATE_INSENSITIVE
]);
/* Default base */
sys_color_to_gtk_color
(
COLOR_WINDOW
,
&
style
->
base
[
GTK_STATE_NORMAL
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHT
,
&
style
->
base
[
GTK_STATE_ACTIVE
]);
sys_color_to_gtk_color
(
COLOR_WINDOW
,
&
style
->
base
[
GTK_STATE_PRELIGHT
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHT
,
&
style
->
base
[
GTK_STATE_SELECTED
]);
sys_color_to_gtk_color
(
COLOR_3DFACE
,
&
style
->
base
[
GTK_STATE_INSENSITIVE
]);
/* Default text */
sys_color_to_gtk_color
(
COLOR_WINDOWTEXT
,
&
style
->
text
[
GTK_STATE_NORMAL
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHTTEXT
,
&
style
->
text
[
GTK_STATE_ACTIVE
]);
sys_color_to_gtk_color
(
COLOR_WINDOWTEXT
,
&
style
->
text
[
GTK_STATE_PRELIGHT
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHTTEXT
,
&
style
->
text
[
GTK_STATE_SELECTED
]);
sys_color_to_gtk_color
(
COLOR_GRAYTEXT
,
&
style
->
text
[
GTK_STATE_INSENSITIVE
]);
/* Prelight */
sys_color_to_gtk_color
(
COLOR_HIGHLIGHTTEXT
,
&
fg_prelight
);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHT
,
&
bg_prelight
);
...
...
@@ -382,20 +357,6 @@ setup_system_styles(GtkStyle *style)
/* progress bar background color */
sys_color_to_gtk_color
(
COLOR_HIGHLIGHT
,
&
progress_back
);
for
(
i
=
0
;
i
<
5
;
i
++
)
{
sys_color_to_gtk_color
(
COLOR_3DSHADOW
,
&
style
->
dark
[
i
]);
sys_color_to_gtk_color
(
COLOR_3DHILIGHT
,
&
style
->
light
[
i
]);
style
->
mid
[
i
].
red
=
(
style
->
light
[
i
].
red
+
style
->
dark
[
i
].
red
)
/
2
;
style
->
mid
[
i
].
green
=
(
style
->
light
[
i
].
green
+
style
->
dark
[
i
].
green
)
/
2
;
style
->
mid
[
i
].
blue
=
(
style
->
light
[
i
].
blue
+
style
->
dark
[
i
].
blue
)
/
2
;
style
->
text_aa
[
i
].
red
=
(
style
->
text
[
i
].
red
+
style
->
base
[
i
].
red
)
/
2
;
style
->
text_aa
[
i
].
green
=
(
style
->
text
[
i
].
green
+
style
->
base
[
i
].
green
)
/
2
;
style
->
text_aa
[
i
].
blue
=
(
style
->
text
[
i
].
blue
+
style
->
base
[
i
].
blue
)
/
2
;
}
/* Enable coloring for menus. */
font_ptr
=
sys_font_to_pango_font
(
MENU_FONT
,
font_buf
);
sprintf
(
buf
,
"style
\"
wimp-menu
\"
=
\"
wimp-default
\"\n
"
...
...
@@ -519,6 +480,54 @@ setup_system_styles(GtkStyle *style)
gtk_rc_parse_string
(
buf
);
}
static
void
setup_system_styles
(
GtkStyle
*
style
)
{
int
i
;
/* Default forgeground */
sys_color_to_gtk_color
(
COLOR_WINDOWTEXT
,
&
style
->
fg
[
GTK_STATE_NORMAL
]);
sys_color_to_gtk_color
(
COLOR_WINDOWTEXT
,
&
style
->
fg
[
GTK_STATE_ACTIVE
]);
sys_color_to_gtk_color
(
COLOR_WINDOWTEXT
,
&
style
->
fg
[
GTK_STATE_PRELIGHT
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHTTEXT
,
&
style
->
fg
[
GTK_STATE_SELECTED
]);
sys_color_to_gtk_color
(
COLOR_GRAYTEXT
,
&
style
->
fg
[
GTK_STATE_INSENSITIVE
]);
/* Default background */
sys_color_to_gtk_color
(
COLOR_3DFACE
,
&
style
->
bg
[
GTK_STATE_NORMAL
]);
sys_color_to_gtk_color
(
COLOR_SCROLLBAR
,
&
style
->
bg
[
GTK_STATE_ACTIVE
]);
sys_color_to_gtk_color
(
COLOR_3DFACE
,
&
style
->
bg
[
GTK_STATE_PRELIGHT
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHT
,
&
style
->
bg
[
GTK_STATE_SELECTED
]);
sys_color_to_gtk_color
(
COLOR_3DFACE
,
&
style
->
bg
[
GTK_STATE_INSENSITIVE
]);
/* Default base */
sys_color_to_gtk_color
(
COLOR_WINDOW
,
&
style
->
base
[
GTK_STATE_NORMAL
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHT
,
&
style
->
base
[
GTK_STATE_ACTIVE
]);
sys_color_to_gtk_color
(
COLOR_WINDOW
,
&
style
->
base
[
GTK_STATE_PRELIGHT
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHT
,
&
style
->
base
[
GTK_STATE_SELECTED
]);
sys_color_to_gtk_color
(
COLOR_3DFACE
,
&
style
->
base
[
GTK_STATE_INSENSITIVE
]);
/* Default text */
sys_color_to_gtk_color
(
COLOR_WINDOWTEXT
,
&
style
->
text
[
GTK_STATE_NORMAL
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHTTEXT
,
&
style
->
text
[
GTK_STATE_ACTIVE
]);
sys_color_to_gtk_color
(
COLOR_WINDOWTEXT
,
&
style
->
text
[
GTK_STATE_PRELIGHT
]);
sys_color_to_gtk_color
(
COLOR_HIGHLIGHTTEXT
,
&
style
->
text
[
GTK_STATE_SELECTED
]);
sys_color_to_gtk_color
(
COLOR_GRAYTEXT
,
&
style
->
text
[
GTK_STATE_INSENSITIVE
]);
for
(
i
=
0
;
i
<
5
;
i
++
)
{
sys_color_to_gtk_color
(
COLOR_3DSHADOW
,
&
style
->
dark
[
i
]);
sys_color_to_gtk_color
(
COLOR_3DHILIGHT
,
&
style
->
light
[
i
]);
style
->
mid
[
i
].
red
=
(
style
->
light
[
i
].
red
+
style
->
dark
[
i
].
red
)
/
2
;
style
->
mid
[
i
].
green
=
(
style
->
light
[
i
].
green
+
style
->
dark
[
i
].
green
)
/
2
;
style
->
mid
[
i
].
blue
=
(
style
->
light
[
i
].
blue
+
style
->
dark
[
i
].
blue
)
/
2
;
style
->
text_aa
[
i
].
red
=
(
style
->
text
[
i
].
red
+
style
->
base
[
i
].
red
)
/
2
;
style
->
text_aa
[
i
].
green
=
(
style
->
text
[
i
].
green
+
style
->
base
[
i
].
green
)
/
2
;
style
->
text_aa
[
i
].
blue
=
(
style
->
text
[
i
].
blue
+
style
->
base
[
i
].
blue
)
/
2
;
}
}
static
gboolean
sanitize_size
(
GdkWindow
*
window
,
gint
*
width
,
...
...
@@ -1515,16 +1524,9 @@ wimp_style_init_from_rc (GtkStyle * style, GtkRcStyle * rc_style)
{
setup_system_font
(
style
);
setup_system_styles
(
style
);
setup_system_settings
(
style
);
parent_class
->
init_from_rc
(
style
,
rc_style
);
}
static
void
wimp_style_init
(
WimpStyle
*
style
)
{
xp_theme_init
();
}
static
void
wimp_style_class_init
(
WimpStyleClass
*
klass
)
{
...
...
@@ -1563,7 +1565,7 @@ wimp_style_register_type (GTypeModule *module)
NULL
,
/* class_data */
sizeof
(
WimpStyle
),
0
,
/* n_preallocs */
(
GInstanceInitFunc
)
wimp_style_init
,
(
GInstanceInitFunc
)
NULL
,
};
wimp_type_style
=
g_type_module_register_type
(
module
,
...
...
@@ -1571,3 +1573,11 @@ wimp_style_register_type (GTypeModule *module)
"WimpStyle"
,
&
object_info
,
0
);
}
void
wimp_init
(
void
)
{
xp_theme_init
();
setup_system_settings
();
setup_wimp_rc_style
();
}
\ No newline at end of file
modules/engines/ms-windows/wimp_style.h
View file @
2af224b3
...
...
@@ -48,5 +48,6 @@ struct _WimpStyleClass
};
void
wimp_style_register_type
(
GTypeModule
*
module
);
void
wimp_style_init
(
void
);
#endif
/* WIMP_TYPE_STYLE */
modules/engines/ms-windows/wimp_theme_main.c
View file @
2af224b3
...
...
@@ -43,6 +43,7 @@ global_filter_func (void *xevent,
case
WM_THEMECHANGED
:
case
WM_SYSCOLORCHANGE
:
xp_theme_exit
();
wimp_init
();
gtk_rc_reparse_all_for_settings
(
gtk_settings_get_default
(),
TRUE
);
return
GDK_FILTER_REMOVE
;
default:
...
...
@@ -56,6 +57,7 @@ theme_init (GTypeModule *module)
wimp_rc_style_register_type
(
module
);
wimp_style_register_type
(
module
);
wimp_init
();
gdk_window_add_filter
(
NULL
,
global_filter_func
,
NULL
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment