Browse Source

neercs: fix Windows build.

master
Sam Hocevar 12 years ago
parent
commit
f347d58585
5 changed files with 28 additions and 44 deletions
  1. +4
    -5
      neercs/neercs.vcxproj
  2. +6
    -6
      neercs/neercs.vcxproj.filters
  3. +2
    -1
      neercs/old/wm.cpp
  4. +7
    -32
      neercs/term/pty.cpp
  5. +9
    -0
      neercs/term/term.cpp

+ 4
- 5
neercs/neercs.vcxproj View File

@@ -49,7 +49,6 @@
<ItemGroup>
<ClCompile Include="neercs.cpp" />
<ClCompile Include="old\actions.c" />
<ClCompile Include="old\ansi.c" />
<ClCompile Include="old\attach.c" />
<ClCompile Include="old\client.c" />
<ClCompile Include="old\configuration.c" />
@@ -70,9 +69,9 @@
<ClCompile Include="old\server.c" />
<ClCompile Include="old\widgets.c" />
<ClCompile Include="old\wm.cpp" />
<ClInclude Include="term\ansi.cpp" />
<ClInclude Include="term\pty.cpp" />
<ClInclude Include="term\term.cpp" />
<ClCompile Include="term\pty.cpp" />
<ClCompile Include="term\term.cpp" />
<ClCompile Include="term\ansi.cpp" />
<ClCompile Include="video\render.cpp" />
<ClCompile Include="video\text-render.cpp" />
</ItemGroup>
@@ -121,4 +120,4 @@
<ImportGroup Label="ExtensionTargets">
<Import Project="$(SolutionDir)\Lol.Fx.targets" />
</ImportGroup>
</Project>
</Project>

+ 6
- 6
neercs/neercs.vcxproj.filters View File

@@ -11,9 +11,6 @@
<ClCompile Include="old\actions.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\ansi.c">
<Filter>old</Filter>
</ClCompile>
<ClCompile Include="old\attach.c">
<Filter>old</Filter>
</ClCompile>
@@ -107,10 +104,10 @@
<ClInclude Include="old\python\py_module.h">
<Filter>old\python</Filter>
</ClInclude>
<ClInclude Include="term\term.h">
<ClInclude Include="term\pty.h">
<Filter>term</Filter>
</ClInclude>
<ClInclude Include="term\pty.h">
<ClInclude Include="term\term.h">
<Filter>term</Filter>
</ClInclude>
</ItemGroup>
@@ -124,6 +121,9 @@
<Filter Include="old\python">
<UniqueIdentifier>{9140687d-c5b2-4302-8121-9b12ebf3908e}</UniqueIdentifier>
</Filter>
<Filter Include="term">
<UniqueIdentifier>{17f5f0be-6afb-4e39-8cb1-07df59d7ba9b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<LolFxCompile Include="video\simple.lolfx">
@@ -157,4 +157,4 @@
<Filter>video</Filter>
</LolFxCompile>
</ItemGroup>
</Project>
</Project>

+ 2
- 1
neercs/old/wm.cpp View File

@@ -61,7 +61,8 @@ void resize_screen(struct screen *s, int w, int h)
s->cv = newc;
caca_gotoxy(newc, caca_get_cursor_x(oldc), caca_get_cursor_y(oldc));
caca_free_canvas(oldc);
set_tty_size(s->fd, w, h);
/* FIXME: disabled */
//set_tty_size(s->fd, w, h);

s->orig_w = s->w;
s->orig_h = s->h;


+ 7
- 32
neercs/term/pty.cpp View File

@@ -39,7 +39,7 @@
using namespace std;
using namespace lol;

#include "neercs.h"
#include "../neercs.h"

Pty::Pty()
: m_fd(-1),
@@ -52,12 +52,14 @@ Pty::Pty()

Pty::~Pty()
{
#if defined HAVE_PTY_H || defined HAVE_UTIL_H || defined HAVE_LIBUTIL_H
delete m_unread_data;

if (m_fd >= 0)
{
close((int)m_fd);
}
#endif
}

void Pty::Run(char const *command, ivec2 size)
@@ -104,6 +106,7 @@ void Pty::Run(char const *command, ivec2 size)

size_t Pty::ReadData(char *data, size_t maxlen)
{
#if defined HAVE_PTY_H || defined HAVE_UTIL_H || defined HAVE_LIBUTIL_H
/* Do we have data from previous call? */
if (m_unread_len)
{
@@ -151,12 +154,14 @@ size_t Pty::ReadData(char *data, size_t maxlen)
}
}
}
#endif

return 0;
}

void Pty::UnreadData(char *data, size_t len)
{
#if defined HAVE_PTY_H || defined HAVE_UTIL_H || defined HAVE_LIBUTIL_H
char *new_data;

if (m_unread_data)
@@ -172,6 +177,7 @@ void Pty::UnreadData(char *data, size_t len)

memcpy(new_data, data, len);
m_unread_data = new_data;
#endif
}

void Pty::SetWindowSize(ivec2 size, int64_t fd /* = -1 */)
@@ -193,34 +199,3 @@ void Pty::SetWindowSize(ivec2 size, int64_t fd /* = -1 */)
ioctl((int)fd, TIOCSWINSZ, (char *)&ws);
#endif
}

#if 0
int update_terms(struct screen_list *screen_list)
{
int i, refresh = 0;
for (i = 0; i < screen_list->count; i++)
{
if (screen_list->screen[i]->total && !screen_list->dont_update_coords)
{
unsigned long int bytes;

bytes = import_term(screen_list,
screen_list->screen[i],
screen_list->screen[i]->buf,
screen_list->screen[i]->total);

if (bytes > 0)
{
screen_list->screen[i]->total -= bytes;
memmove(screen_list->screen[i]->buf,
screen_list->screen[i]->buf + bytes,
screen_list->screen[i]->total);
if (screen_list->screen[i]->visible || screen_list->modals.mini)
refresh = 1;
}
}
}
return refresh;
}
#endif


+ 9
- 0
neercs/term/term.cpp View File

@@ -6,6 +6,15 @@
# include "config.h"
#endif

#if defined _XBOX
# define _USE_MATH_DEFINES /* for M_PI */
# include <xtl.h>
#elif defined _WIN32
# define _USE_MATH_DEFINES /* for M_PI */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif

#include "core.h"

using namespace std;


Loading…
Cancel
Save