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

@@ -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",