Reduced warnings on gcc 4.4.1.

Let panel applet use GLOBALFLAGS.
Check for XKBrules from XKB extension and conditionally compile code using it.
This commit is contained in:
Sanel Zukan 2009-11-20 17:08:29 +00:00
parent 7bb1048773
commit 037196c9be
26 changed files with 103 additions and 53 deletions

View File

@ -120,6 +120,9 @@ X_LIBS ?= @X_LIBS@ ;
X_PRE_LIBS ?= @X_PRE_LIBS@ ;
X_EXTRA_LIBS ?= @X_EXTRA_LIBS@ ;
# solo XKB extension library
XKB_LIBS ?= @XKB_LIBS@ ;
# curl libraries
CURL_CFLAGS ?= @CURL_CFLAGS@ ;
CURL_LIBS ?= @CURL_LIBS@ ;

View File

@ -212,6 +212,36 @@ fi
dnl emits PTHREAD_CFLAGS and PTHREAD_LIBS
ACX_PTHREAD
AC_MSG_CHECKING([for XKB extension files])
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $X_CFLAGS"
LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS -lxkbfile"
AC_LANG_SAVE
AC_LANG_C
AC_TRY_LINK([
#include <stdio.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
],[
FILE *fd = fopen("/some/file", "r");
XkbRF_RulesPtr ptr;
XkbRF_LoadRules(fd, ptr);
],[have_xkbrules=yes],[])
AC_LANG_RESTORE
CFLAGS="ac_save_CFLAGS"
LIBS="ac_save_LIBS"
if test "$have_xkbrules" = "yes"; then
AC_DEFINE(HAVE_XKBRULES, 1, [Define to 1 if you have XKB extension])
XKB_LIBS="$X_LIBS -lxkbfile"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
EDE_CHECK_DIR(DBUS_SERVICE_DIR,
[/usr/share/dbus-1/services /usr/local/share/dbus-1/services "$datarootdir/dbus-1/services"])
@ -231,6 +261,7 @@ AC_SUBST(EDELIB_API_INDEX)
AC_SUBST(CURL_CFLAGS)
AC_SUBST(CURL_LIBS)
AC_SUBST(LARGEFILE)
AC_SUBST(XKB_LIBS)
AC_OUTPUT([
Jamconfig

View File

@ -1,5 +1,5 @@
/* XPM */
static char * ede_xpm[] = {
static const char *ede_xpm[] = {
"48 48 351 2",
" c None",
". c #979696",

View File

@ -88,7 +88,7 @@ static AppWindow* dialog_win;
static Fl_Check_Browser* cbrowser;
static char* get_basename(const char* path) {
char* p = strrchr(path, '/');
char* p = (char*)strrchr(path, '/');
if(p)
return (p + 1);

View File

@ -1,5 +1,5 @@
/* XPM */
static char * core_xpm[] = {
static const char *core_xpm[] = {
"16 16 103 2",
" c None",
". c #FF9F10",

View File

@ -26,12 +26,12 @@
#include <FL/Fl_Choice.H>
#include <FL/Fl_Check_Button.H>
#include <FL/Fl_Value_Slider.H>
#include <FL/Fl_Color_Chooser.h>
#include <FL/Fl_File_Chooser.h>
#include <FL/Fl_Shared_Image.h>
#include <FL/Fl_Tiled_Image.h>
#include <FL/Fl_Menu_Button.h>
#include <FL/x.h>
#include <FL/Fl_Color_Chooser.H>
#include <FL/Fl_File_Chooser.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Tiled_Image.H>
#include <FL/Fl_Menu_Button.H>
#include <FL/x.H>
#include <edelib/Nls.h>
#include <edelib/Color.h>

View File

@ -305,7 +305,7 @@ Pixmap create_mask(Fl_Image* img) {
}
char* get_basename(const char* path) {
char* p = strrchr(path, '/');
char* p = (char*)strrchr(path, '/');
if(p)
return (p + 1);

View File

@ -17,7 +17,7 @@
#include <stdio.h>
#include <string.h>
#include <FL/Fl.h>
#include <FL/Fl.H>
#include <edelib/MessageBox.h>
#include <edelib/Window.h>
#include <edelib/Nls.h>

View File

@ -10,15 +10,14 @@
* See COPYING for details.
*/
#include <Fl/Fl.h>
#include <Fl/Fl_Window.h>
#include <Fl/Fl_Button.h>
#include <Fl/Fl_Shared_Image.h>
#include <Fl/Fl_Scroll.h>
#include <Fl/Fl_Widget.h>
#include <Fl/Fl_File_Chooser.h>
#include <Fl/filename.h>
#include <Fl/Fl.H>
#include <Fl/Fl_Window.H>
#include <Fl/Fl_Button.H>
#include <Fl/Fl_Shared_Image.H>
#include <Fl/Fl_Scroll.H>
#include <Fl/Fl_Widget.H>
#include <Fl/Fl_File_Chooser.H>
#include <Fl/filename.H>
#include <stdio.h>
#include <stdlib.h>
@ -369,7 +368,7 @@ int main (int argc, char **argv) {
Fl::args(argc,argv,unknown);
filename[0]='\0'; directory[0]='\0';
if (unknown==argc)
snprintf(directory, FL_PATH_MAX, getenv("HOME"));
snprintf(directory, FL_PATH_MAX, "%s", getenv("HOME"));
else {
if (strcmp(argv[unknown],"--help")==0) {
printf(_("EImage - EDE Image Viewer\nPart of Equinox Desktop Environment (EDE).\nCopyright (c) 2000-2007 EDE Authors.\n\nThis program is licenced under terms of the\nGNU General Public Licence version 2 or newer.\nSee COPYING for details.\n\n"));
@ -379,14 +378,14 @@ int main (int argc, char **argv) {
}
if (fl_filename_isdir(argv[unknown])) { // Param is directory
snprintf(directory, FL_PATH_MAX, argv[unknown]);
snprintf(directory, FL_PATH_MAX, "%s", argv[unknown]);
if (directory[0] == '~' && directory[1] == '/') // expand home dir
snprintf (directory, FL_PATH_MAX, "%s%s", getenv("HOME"), argv[unknown]+1);
else if (directory[0] != '/') // relative path
snprintf (directory, FL_PATH_MAX, "%s/%s", getenv("PWD"), argv[unknown]);
} else {
snprintf (filename, FL_PATH_MAX, argv[unknown]);
snprintf (filename, FL_PATH_MAX, "%s", argv[unknown]);
if (filename[0] == '~' && filename[1] == '/') // expand home dir
snprintf (filename, FL_PATH_MAX, "%s%s", getenv("HOME"), argv[unknown]+1);
else if (filename[0] != '/') // relative filename

View File

@ -13,6 +13,6 @@ SubDir TOP ede-keyboard-conf ;
SRC = ede-keyboard-conf.cpp ;
EdeProgram ede-keyboard-conf : $(SRC) ;
LinkAgainst ede-keyboard-conf : $(X_LIBS) -lxkbfile ;
LinkAgainst ede-keyboard-conf : $(XKB_LIBS) ;
TranslationStrings locale : $(SRC) ;

View File

@ -14,6 +14,11 @@
#include <config.h>
#endif
#include <edelib/MessageBox.h>
#include <edelib/Nls.h>
EDELIB_NS_USING(alert)
#ifdef HAVE_XKBRULES
#include <stdio.h>
#include <string.h>
#include <FL/Fl.H>
@ -29,7 +34,6 @@
#include <X11/extensions/XKBrules.h>
#include <edelib/Window.h>
#include <edelib/Nls.h>
#include <edelib/Debug.h>
#include <edelib/String.h>
#include <edelib/Resource.h>
@ -47,7 +51,6 @@ EDELIB_NS_USING(String)
EDELIB_NS_USING(Resource)
EDELIB_NS_USING(file_path)
EDELIB_NS_USING(run_sync)
EDELIB_NS_USING(alert)
EDELIB_NS_USING(foreign_callback_call)
static AppWindow *win;
@ -213,8 +216,10 @@ static void apply_chages_from_config(void) {
/* TODO: this should be validated somehow */
apply_changes_on_x(buf, NULL);
}
#endif /* HAVE_XKBRULES */
int main(int argc, char **argv) {
#ifdef HAVE_XKBRULES
/* must be opened first */
fl_open_display();
@ -294,5 +299,9 @@ int main(int argc, char **argv) {
if(xkb_rules)
XkbRF_Free(xkb_rules, True);
#else
alert(_("ede-keyboard-conf was compiled without XKB extension. Please recompile it again"));
#endif /* HAVE_XKBRULES */
return 0;
}

View File

@ -67,7 +67,7 @@ static void help(void) {
}
static char* get_basename(const char* path) {
char *p = strrchr(path, '/');
char *p = (char*)strrchr(path, '/');
if(p)
return (p + 1);
@ -271,7 +271,7 @@ static void ok_cb(Fl_Widget*, void* w) {
/* TODO: is 'cmd' safe after hide? */
if(in_term->value()) {
char buf[128];
char* term = getenv("TERM");
const char* term = getenv("TERM");
/* also check if TERM get inherited from login console */
if(!term || strcmp(term, "linux") == 0)

View File

@ -1,5 +1,5 @@
/* XPM */
static char * run_xpm[] = {
static const char *run_xpm[] = {
"32 32 516 2",
" c None",
". c #C9EFF9",

View File

@ -11,7 +11,7 @@
SubDir TOP ede-panel ;
# make it as library, so applets can use it too
ObjectC++Flags Netwm.cpp : -g3 -fPIC $(FLTKINCLUDE) $(EDELIBINCLUDE) ;
ObjectC++Flags Netwm.cpp : $(GLOBALFLAGS) -fPIC $(FLTKINCLUDE) $(EDELIBINCLUDE) ;
StaticLibrary libnetwm : Netwm.cpp ;
NETWMLIB = -L$(SUBDIR) -lnetwm ;
@ -38,7 +38,7 @@ rule PanelApplet
target = $(<:S=$(SUFLIB_SHARED)) ;
Main $(target) : $(>) ;
ObjectC++Flags $(>) : -fPIC $(FLTKINCLUDE) -I [ FDirName $(TOP) ede-panel ] $(EDELIBINCLUDE) ;
ObjectC++Flags $(>) : $(GLOBALFLAGS) -fPIC $(FLTKINCLUDE) -I [ FDirName $(TOP) ede-panel ] $(EDELIBINCLUDE) ;
LinkAgainst $(target) : $(NETWMLIB) $(3) $(EDELIBLIB) $(EDELIB_GUI_LIB) $(FLTKLIB) $(STDLIB) ;
LINKFLAGS on $(target) = $(linker_stuff) [ on $(target) return $(LINKFLAGS) ] ;

View File

@ -10,4 +10,4 @@
SubDir TOP ede-panel applets keyboard-layout ;
PanelApplet keyboard_layout : KeyLayout.cpp : $(X_LIBS) -lxkbfile ;
PanelApplet keyboard_layout : KeyLayout.cpp : $(XKB_LIBS) ;

View File

@ -1,5 +1,9 @@
#include "Applet.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <FL/Fl_Button.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/x.H>
@ -7,9 +11,11 @@
#include <stdio.h> /* needed for XKBrules.h */
#include <X11/XKBlib.h>
#include <X11/extensions/XKBgeom.h>
#include <X11/extensions/XKBrules.h>
#ifdef HAVE_XKBRULES
# include <X11/XKBlib.h>
# include <X11/extensions/XKBgeom.h>
# include <X11/extensions/XKBrules.h>
#endif
#include <edelib/Resource.h>
#include <edelib/Debug.h>
@ -52,6 +58,7 @@ typedef list<KeyLayout*>::iterator KeyLayoutListIt;
static KeyLayoutList keylayout_objects;
#ifdef HAVE_XKBRULES
/* Xkb does not provide this */
static void xkbrf_names_prop_free(XkbRF_VarDefsRec &vd, char *tmp) {
XFree(tmp);
@ -60,6 +67,7 @@ static void xkbrf_names_prop_free(XkbRF_VarDefsRec &vd, char *tmp) {
XFree(vd.options);
XFree(vd.variant);
}
#endif
/*
* any layout changes on X will be reported here, executed either via ede-keyboard-conf or
@ -113,8 +121,10 @@ KeyLayout::KeyLayout() : Fl_Button(0, 0, 30, 25) {
keylayout_objects.push_back(this);
/* with this, kb layout chages will be catched */
#if HAVE_XKBRULES
if(!_XA_XKB_RF_NAMES_PROP_ATOM)
_XA_XKB_RF_NAMES_PROP_ATOM = XInternAtom(fl_display, _XKB_RF_NAMES_PROP_ATOM, False);
#endif
Fl::add_handler(xkb_events);
}
@ -156,12 +166,11 @@ void KeyLayout::update_flag(bool read_config) {
}
void KeyLayout::do_key_layout(void) {
#ifdef HAVE_XKBRULES
char *tmp = NULL;
XkbRF_VarDefsRec vd;
if(XkbRF_GetNamesProp(fl_display, &tmp, &vd)) {
Fl_Image *img = NULL;
/* do nothing if layout do not exists or the same was catched */
if(!vd.layout || (curr_layout == vd.layout))
return;
@ -170,6 +179,7 @@ void KeyLayout::do_key_layout(void) {
curr_layout = vd.layout;
xkbrf_names_prop_free(vd, tmp);
}
#endif
}
int KeyLayout::handle(int e) {

View File

@ -57,7 +57,6 @@ void Pager::init_workspace_boxes(void) {
int nworkspaces, curr_workspace;
char **names = 0;
char nbuf[16];
nworkspaces = netwm_get_workspace_count();
curr_workspace = netwm_get_current_workspace();

View File

@ -76,8 +76,7 @@ void Taskbar::create_task_buttons(void) {
if(nwins > 0) {
TaskButton *b;
int curr_workspace = netwm_get_current_workspace();
char *title;
int curr_workspace = netwm_get_current_workspace();
for(int i = 0; i < nwins; i++) {
if(!netwm_manageable_window(wins[i]))
@ -158,7 +157,7 @@ void Taskbar::update_active_button(int xid) {
for(int i = 0; i < children(); i++) {
o = (TaskButton*)child(i);
if(o->get_window_xid() == xid)
if(o->get_window_xid() == (Window)xid)
o->box(FL_DOWN_BOX);
else
o->box(FL_UP_BOX);

View File

@ -1,5 +1,5 @@
/* XPM */
static char * window_xpm[] = {
static const char *window_xpm[] = {
"16 16 57 1",
" c None",
". c #BABDB6",

View File

@ -130,7 +130,7 @@ static void min_to_time(unsigned int t, String& ret) {
unsigned int hour = 0, min = 0;
char buf[3];
char* fmt;
const char* fmt;
/* assure we do not get values that exceedes a day (24 * 60 = 1440) */
if(t >= 1440) {
@ -636,8 +636,8 @@ void xscreensaver_preview(int id, const char* name) {
case 0: {
usleep(250000);
char* argv[4];
argv[0] = "sh";
argv[1] = "-c";
argv[0] = (char*)"sh";
argv[1] = (char*)"-c";
argv[2] = (char*)cmd.c_str();
argv[3] = NULL;
execve("/bin/sh", argv, environ);

View File

@ -1,5 +1,5 @@
/* XPM */
static char * energy_star_xpm[] = {
static const char *energy_star_xpm[] = {
"64 64 1305 2",
" c None",
". c #D1EFFF",

View File

@ -57,7 +57,7 @@ bool time_changed, format_changed, tz_changed, date_changed;
// config file for workpanel (time format)
edelib::Config config_file;
char* zonetab_dir = 0;
const char* zonetab_dir = 0;
// Time servers - all in one string, so that translators can easily add new servers
const char* time_servers = _("International (pool.ntp.org)\nEurope (europe.pool.ntp.org)\nAsia (asia.pool.ntp.org)\nNorth America (north-america.pool.ntp.org)\nAustralia and Oceania (oceania.pool.ntp.org)");

View File

@ -1,5 +1,5 @@
/* XPM */
const char *world[] = {
static const char *world[] = {
"356 184 3 1",
". c #000078",
"# c #007800",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * world2_xpm[] = {
static const char *world2_xpm[] = {
"395 170 3 1",
" c None",
". c #00017A",

View File

@ -1,5 +1,5 @@
/* XPM */
static char * hint_xpm[] = {
static const char *hint_xpm[] = {
"118 197 174 2",
" c #F1F3F5",
". c #F2F4F6",

View File

@ -53,9 +53,9 @@ EDELIB_NS_USING(XSETTINGS_TYPE_INT)
EDELIB_NS_USING(XSETTINGS_TYPE_STRING)
struct ResourceMap {
char* name;
char* xresource_key;
char* xresource_klass;
const char* name;
const char* xresource_key;
const char* xresource_klass;
};
/*