Skip to content

Commit

Permalink
wrap all C includes with 'extern "C" {}'
Browse files Browse the repository at this point in the history
fix updateAvailableArea, maximize and placeWindow work properly now.
  • Loading branch information
shaleh committed Mar 31, 2002
1 parent ec4cb07 commit 0cfa73d
Show file tree
Hide file tree
Showing 32 changed files with 115 additions and 43 deletions.
2 changes: 2 additions & 0 deletions src/BaseDisplay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# include "../config.h"
#endif // HAVE_CONFIG_H

extern "C" {
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
Expand Down Expand Up @@ -75,6 +76,7 @@
# include <sys/types.h>
# include <sys/wait.h>
#endif // HAVE_SYS_WAIT_H
}

#include "i18n.hh"
#include "BaseDisplay.hh"
Expand Down
2 changes: 2 additions & 0 deletions src/BaseDisplay.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
#ifndef __BaseDisplay_hh
#define __BaseDisplay_hh

extern "C" {
#include <X11/Xlib.h>
#include <X11/Xatom.h>
}

#include <vector>

Expand Down
2 changes: 2 additions & 0 deletions src/Basemenu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# include "../config.h"
#endif // HAVE_CONFIG_H

extern "C" {
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif // HAVE_STDIO_H
Expand All @@ -36,6 +37,7 @@
#ifdef HAVE_STRING_H
# include <string.h>
#endif // HAVE_STRING_H
}

#include <algorithm>
using namespace std;
Expand Down
4 changes: 3 additions & 1 deletion src/Basemenu.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#ifndef __Basemenu_hh
#define __Basemenu_hh

extern "C" {
#include <X11/Xlib.h>
}

#include <string>
#include <deque>
Expand Down Expand Up @@ -98,7 +100,7 @@ public:
int insert(const std::string &label, Basemenu *submenu, int pos = -1);
int remove(int index);

void changeItemLabel(unsigned int index, const string& label);
void changeItemLabel(unsigned int index, const std::string& label);

inline int getX(void) const { return menu.x; }
inline int getY(void) const { return menu.y; }
Expand Down
3 changes: 3 additions & 0 deletions src/Color.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
#include "Color.hh"
#include "BaseDisplay.hh"

extern "C" {
#include <stdio.h>
}


BColor::ColorCache BColor::colorcache;
bool BColor::cleancache = false;
Expand Down
2 changes: 2 additions & 0 deletions src/Color.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#ifndef COLOR_HH
#define COLOR_HH

extern "C" {
#include <X11/Xlib.h>
}

#include <map>
#include <string>
Expand Down
2 changes: 2 additions & 0 deletions src/GCCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
#include "Color.hh"
#include "Util.hh"

extern "C" {
#include <stdio.h>
}


void BGCCacheContext::set(const BColor &_color,
Expand Down
2 changes: 2 additions & 0 deletions src/GCCache.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#ifndef GCCACHE_HH
#define GCCACHE_HH

extern "C" {
#include <X11/Xlib.h>
}

#include "BaseDisplay.hh"
#include "Color.hh"
Expand Down
2 changes: 2 additions & 0 deletions src/Image.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
#ifndef __Image_hh
#define __Image_hh

extern "C" {
#include <X11/Xlib.h>
#include <X11/Xutil.h>
}

#include <list>

Expand Down
2 changes: 2 additions & 0 deletions src/ImageControl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# include "../config.h"
#endif // HAVE_CONFIG_H

extern "C" {
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif // HAVE_STDIO_H
Expand All @@ -34,6 +35,7 @@
#endif // HAVE_CTYPE_H

#include <X11/Xlib.h>
}

#include <algorithm>

Expand Down
2 changes: 2 additions & 0 deletions src/Netizen.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#ifndef __Netizen_hh
#define __Netizen_hh

extern "C" {
#include <X11/Xlib.h>
}

// forward declaration
class Blackbox;
Expand Down
12 changes: 7 additions & 5 deletions src/Rootmenu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@
# include "../config.h"
#endif // HAVE_CONFIG_H

#include "blackbox.hh"
#include "Rootmenu.hh"
#include "Screen.hh"
#include "Util.hh"

extern "C" {
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif // HAVE_STDIO_H
Expand All @@ -45,6 +41,12 @@
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif // HAVE_SYS_PARAM_H
}

#include "blackbox.hh"
#include "Rootmenu.hh"
#include "Screen.hh"
#include "Util.hh"


Rootmenu::Rootmenu(BScreen *scrn) : Basemenu(scrn) {
Expand Down
33 changes: 20 additions & 13 deletions src/Screen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# include "../config.h"
#endif // HAVE_CONFIG_H

extern "C" {
#include <X11/Xatom.h>
#include <X11/keysym.h>

Expand Down Expand Up @@ -65,6 +66,7 @@
#ifdef HAVE_STDARG_H
# include <stdarg.h>
#endif // HAVE_STDARG_H
}

#include "i18n.hh"
#include "blackbox.hh"
Expand Down Expand Up @@ -1671,28 +1673,33 @@ void BScreen::updateAvailableArea(void) {
old_width = usableArea.width, old_height = usableArea.height;

StrutList::iterator it = strutList.begin();
unsigned int current_left = 0, current_right = 0, current_top = 0,
current_bottom = 0;

usableArea = getRect(); // reset to full screen
for(; it != strutList.end(); ++it) {
NETStrut *strut = *it;
if ((signed)strut->left > usableArea.x)
usableArea.x = strut->left;

if ((signed)strut->top > usableArea.y)
usableArea.y = strut->top;

if (((usableArea.width + old_x) - strut->right) < usableArea.width)
usableArea.width = getWidth() - strut->right - usableArea.x;

if (((usableArea.height + old_y) - strut->bottom) < usableArea.height)
usableArea.height = getHeight() - strut->bottom - usableArea.y;
fprintf(stderr, "screen: %d; left: %d, top: %d, right: %d, bottom: %d\n",
getScreenNumber(),
strut->left, strut->top, strut->right, strut->bottom);
if (strut->left > current_left)
current_left = strut->left;
if (strut->top > current_top)
current_top = strut->top;
if (strut->right > current_right)
current_right = strut->right;
if (strut->bottom > current_bottom)
current_bottom = strut->bottom;
}

usableArea.x = current_left;
usableArea.width -= usableArea.x + current_right;
usableArea.y = current_top;
usableArea.height -= usableArea.y + current_bottom;

// if area changed
if (old_x != usableArea.x || old_y != usableArea.y ||
old_width != usableArea.width || old_height != usableArea.height) {
usableArea.width += old_x - usableArea.x;
usableArea.height += old_y - usableArea.y;
BlackboxWindowList::iterator it = windowList.begin(),
end = windowList.end();
for(; it != end; ++it)
Expand Down
2 changes: 2 additions & 0 deletions src/Screen.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#ifndef __Screen_hh
#define __Screen_hh

extern "C" {
#include <X11/Xlib.h>
#include <X11/Xresource.h>

Expand All @@ -37,6 +38,7 @@
# include <time.h>
# endif // HAVE_SYS_TIME_H
#endif // TIME_WITH_SYS_TIME
}

#include <list>
#include <vector>
Expand Down
2 changes: 2 additions & 0 deletions src/Slit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
# include "../config.h"
#endif // HAVE_CONFIG_H

extern "C" {
#include <X11/keysym.h>
}

#include "i18n.hh"
#include "blackbox.hh"
Expand Down
2 changes: 2 additions & 0 deletions src/Slit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
#ifndef __Slit_hh
#define __Slit_hh

extern "C" {
#include <X11/Xlib.h>
#include <X11/Xutil.h>
}

#include <list>

Expand Down
2 changes: 2 additions & 0 deletions src/Texture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
# include "../config.h"
#endif // HAVE_CONFIG_H

extern "C" {
#include <stdio.h>
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
}

#include "Texture.hh"
#include "BaseDisplay.hh"
Expand Down
2 changes: 2 additions & 0 deletions src/Timer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#ifndef _BLACKBOX_Timer_hh
#define _BLACKBOX_Timer_hh

extern "C" {
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
Expand All @@ -34,6 +35,7 @@
# include <time.h>
# endif // HAVE_SYS_TIME_H
#endif // TIME_WITH_SYS_TIME
}

// forward declaration
class TimerQueueManager;
Expand Down
32 changes: 17 additions & 15 deletions src/Toolbar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,7 @@
# include "../config.h"
#endif // HAVE_CONFIG_H

#include "i18n.hh"
#include "blackbox.hh"
#include "Clientmenu.hh"
#include "GCCache.hh"
#include "Iconmenu.hh"
#include "Image.hh"
#include "Rootmenu.hh"
#include "Screen.hh"
#include "Toolbar.hh"
#include "Window.hh"
#include "Workspace.hh"
#include "Workspacemenu.hh"
#include "Slit.hh"

extern "C" {
#include <X11/Xutil.h>
#include <X11/keysym.h>

Expand All @@ -60,10 +47,25 @@
# include <time.h>
# endif // HAVE_SYS_TIME_H
#endif // TIME_WITH_SYS_TIME
}

#include <string>
using std::string;

#include "i18n.hh"
#include "blackbox.hh"
#include "Clientmenu.hh"
#include "GCCache.hh"
#include "Iconmenu.hh"
#include "Image.hh"
#include "Rootmenu.hh"
#include "Screen.hh"
#include "Toolbar.hh"
#include "Window.hh"
#include "Workspace.hh"
#include "Workspacemenu.hh"
#include "Slit.hh"


static long aMinuteFromNow(void) {
timeval now;
Expand Down Expand Up @@ -275,7 +277,7 @@ void Toolbar::reconfigure(void) {
case TopLeft:
case TopCenter:
case TopRight:
strut.top = getY() + 1;
strut.top = getHeight() + 1;
break;
default:
strut.bottom = screen->getHeight() - getY() - 1;
Expand Down
2 changes: 2 additions & 0 deletions src/Toolbar.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#ifndef __Toolbar_hh
#define __Toolbar_hh

extern "C" {
#include <X11/Xlib.h>
}

#include "Screen.hh"
#include "Basemenu.hh"
Expand Down
2 changes: 2 additions & 0 deletions src/Util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# include "../config.h"
#endif // HAVE_CONFIG_H

extern "C" {
#ifdef HAVE_STRING_H
#include <string.h>
#endif
Expand All @@ -47,6 +48,7 @@
#if defined(HAVE_PROCESS_H) && defined(__EMX__)
# include <process.h>
#endif // HAVE_PROCESS_H __EMX__
}

#include "Util.hh"

Expand Down
Loading

0 comments on commit 0cfa73d

Please sign in to comment.