Fix FTBFS with glibc 2.25
authorAnton Gladky <gladk@debian.org>
Wed, 22 Nov 2017 08:54:12 +0000 (08:54 +0000)
committerAnton Gladky <gladk@debian.org>
Wed, 22 Nov 2017 08:54:12 +0000 (08:54 +0000)
Bug-Debian: https://bugs.debian.org/882167
Last-Update: 2017-11-21

 Replace CHAR_WIDTH by CHAR_W_SOLVESPACE

Gbp-Pq: Name 30_fix_ftbfs_glibc.patch

src/textwin.cpp
src/toolbar.cpp
src/ui.h
src/win32/w32main.cpp

index 656ac626749859b1a4698f1edfc531c115b14951..ce0f12f626c2afb3ea861dc05afd40e9fabda70e 100644 (file)
@@ -85,7 +85,7 @@ void TextWindow::ShowEditControl(int col, const std::string &str, int halfRow) {
     editControl.halfRow = halfRow;
     editControl.col = col;
 
-    int x = LEFT_MARGIN + CHAR_WIDTH*col;
+    int x = LEFT_MARGIN + CHAR_W_SOLVESPACE*col;
     int y = (halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2);
 
     ShowTextEditControl(x, y + 18, str);
@@ -447,7 +447,7 @@ void TextWindow::DrawOrHitTestIcons(int how, double mx, double my)
             double ox = oldMousePos.x, oy = oldMousePos.y - LINE_HEIGHT;
             ox += 3;
             oy -= 3;
-            int tw = (str.length() + 1)*(CHAR_WIDTH - 1);
+            int tw = (str.length() + 1)*(CHAR_W_SOLVESPACE - 1);
             ox = min(ox, (double) (width - 25) - tw);
             oy = max(oy, 5.0);
 
@@ -583,7 +583,7 @@ bool TextWindow::DrawOrHitTestColorPicker(int how, bool leftDown,
     int width, height;
     GetTextWindowSize(&width, &height);
 
-    int px = LEFT_MARGIN + CHAR_WIDTH*editControl.col;
+    int px = LEFT_MARGIN + CHAR_W_SOLVESPACE*editControl.col;
     int py = (editControl.halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2);
 
     py += LINE_HEIGHT + 5;
@@ -842,8 +842,8 @@ void TextWindow::Paint(void) {
             if(ltop < (scrollPos-1)) continue;
             if(ltop > scrollPos+halfRows) break;
 
-            for(c = 0; c < min((width/CHAR_WIDTH)+1, (int) MAX_COLS); c++) {
-                int x = LEFT_MARGIN + c*CHAR_WIDTH;
+            for(c = 0; c < min((width/CHAR_W_SOLVESPACE)+1, (int) MAX_COLS); c++) {
+                int x = LEFT_MARGIN + c*CHAR_W_SOLVESPACE;
                 int y = (ltop-scrollPos)*(LINE_HEIGHT/2) + 4;
 
                 int fg = meta[r][c].fg;
@@ -866,7 +866,7 @@ void TextWindow::Paint(void) {
                         // Move the quad down a bit, so that the descenders
                         // still have the correct background.
                         y += adj;
-                        ssglAxisAlignedQuad(x, x + CHAR_WIDTH, y, y + bh, false);
+                        ssglAxisAlignedQuad(x, x + CHAR_W_SOLVESPACE, y, y + bh, false);
                         y -= adj;
                     }
                 } else if(a == 1) {
@@ -912,8 +912,8 @@ void TextWindow::Paint(void) {
                         glLineWidth(1);
                         glBegin(GL_LINES);
                             int yp = y + CHAR_HEIGHT;
-                            glVertex2d(LEFT_MARGIN + cs*CHAR_WIDTH, yp);
-                            glVertex2d(LEFT_MARGIN + cf*CHAR_WIDTH, yp);
+                            glVertex2d(LEFT_MARGIN + cs*CHAR_W_SOLVESPACE, yp);
+                            glVertex2d(LEFT_MARGIN + cf*CHAR_W_SOLVESPACE, yp);
                         glEnd();
 
                         glEnable(GL_TEXTURE_2D);
@@ -979,7 +979,7 @@ void TextWindow::MouseEvent(bool leftClick, bool leftDown, double x, double y) {
     hoveredCol = 0;
 
     // Find the corresponding character in the text buffer
-    int c = (int)((x - LEFT_MARGIN) / CHAR_WIDTH);
+    int c = (int)((x - LEFT_MARGIN) / CHAR_W_SOLVESPACE);
     int hh = (LINE_HEIGHT)/2;
     y += scrollPos*hh;
     int r;
index 77f795f02b14faeeab4b7c9b88933178d9b653fd..d491b091052e5923982a7a78831b80376abf4f7b 100644 (file)
@@ -218,7 +218,7 @@ bool GraphicsWindow::ToolbarDrawOrHitTest(int mx, int my,
                 }
             }
 
-            int tw = str.length() * (SS.TW.CHAR_WIDTH - 1) + 10,
+            int tw = str.length() * (SS.TW.CHAR_W_SOLVESPACE - 1) + 10,
                 th = SS.TW.LINE_HEIGHT + 2;
 
             double ox = toolbarMouseX + 3, oy = toolbarMouseY + 3;
index a041ed36d7a1c010268546caf80110230a8cbf7d..f773b5eda5fc14c99043908585fec998eecd994f 100644 (file)
--- a/src/ui.h
+++ b/src/ui.h
@@ -27,7 +27,7 @@ public:
     float fgColorTable[256*3];
 
     enum {
-        CHAR_WIDTH     = 9,
+        CHAR_W_SOLVESPACE     = 9,
         CHAR_HEIGHT    = 16,
         LINE_HEIGHT    = 20,
         LEFT_MARGIN    = 6,
index 562499bdb4f41501ed42e09369d97ee2b422e773..df304f385b8cd93268d46b3b97283abd97e5dad7 100644 (file)
@@ -138,7 +138,7 @@ void SolveSpace::DoMessageBox(const char *str, int rows, int cols, bool error)
     RECT r;
     GetWindowRect(GraphicsWnd, &r);
     const char *title = error ? "SolveSpace - Error" : "SolveSpace - Message";
-    int width  = cols*SS.TW.CHAR_WIDTH + 20,
+    int width  = cols*SS.TW.CHAR_W_SOLVESPACE + 20,
         height = rows*SS.TW.LINE_HEIGHT + 60;
     MessageWidth = width;
     MessageHeight = height;
@@ -546,7 +546,7 @@ LRESULT CALLBACK TextWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                     r->top += extra;
                     break;
             }
-            int tooNarrow = (SS.TW.MIN_COLS*SS.TW.CHAR_WIDTH) -
+            int tooNarrow = (SS.TW.MIN_COLS*SS.TW.CHAR_W_SOLVESPACE) -
                                                 (r->right - r->left);
             if(tooNarrow >= 0) {
                 switch(wParam) {
@@ -1367,7 +1367,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
     InitCommonControls();
 
     // A monospaced font
-    FixedFont = CreateFontW(SS.TW.CHAR_HEIGHT, SS.TW.CHAR_WIDTH, 0, 0,
+    FixedFont = CreateFontW(SS.TW.CHAR_HEIGHT, SS.TW.CHAR_W_SOLVESPACE, 0, 0,
         FW_REGULAR, false,
         false, false, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
         DEFAULT_QUALITY, FF_DONTCARE, L"Lucida Console");