SIL LSDev Linux Development

Language software for Linux and Mac OS X

Controlling IBus with DBusSharp

Rationale

I wanted to be able to change the IBus (Intelligent Input Bus) keyboard programmatically. If a user went into an area of text that had say an Amharic style applied to it and typed, I wanted typing to automatically use the ibus Amharic keyboard/engine. If they then switched to a different area of text with a different style applied to it I wanted the ibus keyboard to again switch automatically. This blog entry shows the steps that I used to achieve this.

Read the rest of this post…

Translation Editor running on Linux!

TE Draft View of Jonah in Sena

Today was a milestone. We demonstrated the Linux version of FieldWorks TE to a group of people at the office chapel time. It worked well enough for the demo, in that it wasn’t slow and didn’t crash, and the people were impressed :-)

Progress has been very rapid in the past month or two, for several reasons, but today was the first time that we felt TE was ready to show to others. It was helpful to have the extra incentive of a scheduled demo for the final push to get things working on a non-developer machine.

Read the rest of this post…

A long-awaited breakthrough

Our porting work depends on having a link from C# to C++ using COM. This is a fundamental requirement, and without it we cannot proceed. Although we’ve had this working in small test programs for a long time, it would crash badly when we tried it with our application (WorldPad, part of FieldWorks). We were fairly sure it was something we were doing wrong, but could never pin it down. Well, now Tom and Brent have found the solution!

Read the rest of this post…

libcom 0.4.0 released

The libcom COM Support Library version 0.4.0 has been released. This is the first release of libcom. libcom is licensed under the LGPL.

libcom implements a subset of Microsoft COM (Component Object Model) and supports both C++ and C# (via Mono) COM clients and servers on Linux. libcom is similar to ole32.dll in Windows.

libcom can be downloaded from http://linux.lsdev.sil.org/wiki/index.php/Downloads.

Update: libcom now has its own web page at http://linux.lsdev.sil.org/wiki/index.php/Libcom.

C++ accessing C# COM objects through CCW in Mono on Linux

Recently we had a couple developers from other offices join us for LSDev Linux Brainstorming Week to learn from one another, talk about technology choices, and do some pair programming.

Recognizing that parts of our C++ code need to be able to access and work with C# objects through COM (Component Object Model), Eberhard and I set out to test this in Mono on Linux.

We were successful in making a C# application create a regular C# object and a C++ object (via libcom and RCW), pass the C# object to the C++ object, have the C++ object modify the C# object from native code, and then back in C# code observe that our C# object was indeed manipulated successfully from C++.

This capability to call back and forth between C# and C++ using COM is very important for porting several SIL programs to Linux, and we were concerned about whether it would even be possible with Mono. We found out several months ago that C# calling into C++ using libcom and Mono RCWs worked, and I was pleased to find that going the other direction, C++ calling C#, elegantly Just Works.

This new test works thanks to Jonathan Chambers‘s implementation of COM Callable Wrappers (CCWs) in Mono, which was announced here.

Eberhard and I largely reused existing libcom test code and just made some additions. The steps to perform this test and an explanation of what is happening can be found on our wiki here.

.NET support in MONO

Most of this comes from the Mono project documentation roadmap available on the Mono site here.

Microsoft has published three versions of the .NET Framework.
1.0 came first, next was 1.1 which incrementally updated the previous version, then 2.0 was a considerable expansion from 1.1.

To the core of .NET an addition, called .NET 3.0 has been released. It is a set of new API’s that run on top of the .NET 2.0 installation. The Mono project has been keeping track of the improvements made in each release, some of the implementations that they have kept up with are:

  • Core: mscorlib, System, System.Security and System.XML assemblies.
  • ADO.NET: System.Data and various other database providers.
  • ASP.NET: WebForms and Web Services are supported. Work on WSE1/WSE2 has also started.
  • Compilers: C#, VB.NET and various command line tools that are part of the SDK.
  • Open Source, Unix and Gnome specific libraries.

Note: The description of the releases is not complete. I am showing the parts of .NET that have been implemented in each release and some other classes. for a complete list they are available on the Mono web site. Read the rest of this post…

COM in Linux

The core of SIL FieldWorks was written in C++. New development in FieldWorks is done in C#, and ties into the C++ core through COM.

After much looking all over the Internet in January 2005, I basically concluded that not only does no one use COM in Linux, but no one wanted to (outside of big enterprise application ports to UNIX).

When both porting FieldWorks to Linux and making it cross-platform, we lose access to Microsoft’s COM implementation in Windows. We were originally going to use SWIG to generate C# wrappers around the C++ core libraries. All C++ methods would then be P/Invoked, and COM would be bypassed.

Then I found that Jonathan Chambers had put a lot of good work into Mono‘s COM support. I was able to have a C# COM client access a C++ COM server in Windows using Mono.

Read the rest of this post…

The look and feel of cross-platform user interfaces

Someone just asked me,

What’s the best way to do a cross-platform product that has the native XXX look and feel?

It depends on exactly what you mean by native look and feel. There are several GUI toolkits that produce the right pixels, so that in a screen shot it would look just like an XXX application, but which still don’t produce an application that feels right. For example, on Mac, if you select a range of text and then press right-arrow, what happens? The insertion point should move to the right boundary of the previous selection. However, on Windows, it typically moves one character beyond that point. I find this inconsistency very frustrating in several of the cross-platform apps that I use regularly.

Also, applications may have the right pixels for all the individual controls, but the overall layout of their UI doesn’t feel comfortable for an XXX user. The classic example is the relative ordering of OK and Cancel buttons in dialogs. Most toolkits now take care of this transparently, but there are other things, such as the extent to which toolbars are used, that can be uncomfortable for users. For example, Mac applications typically use toolbars very sparingly, and Windows apps use them extensively.

Read the rest of this post…

Explorations in GTK# part 2

Glade and custom widgets

Glade and GTK# are a powerful combination. One that we are using for our Mono re-implementation of WorldPad. It’s quite possible to build a very functional application using just the standard widgets provided by GTK, but sometimes specific functionality is needed which is not found in the regular set of widgets.

In this instance, a "custom widget" can be inserted into a Glade interface. This is easy to do, but filling in the custom widget with something useful is a bit more tricky.

Custom widgets in Glade
Above: Custom widgets in Glade.
Below: Custom widgets being implemented as "ColorPickerButton"s in the application.
Custom widgets in use

How do we implement the custom widget?

Read the rest of this post…

Explorations in GTK# part 1

GTK.Settings: What and how

What?…
For the standard set of GTK# widgets, there is a property or method to change almost any aspect of the widgets appearance and behaviour. But some things require using GTK.Settings. For example setting the palette in a colour selector, or changing the cursor behaviour in a text entry.

How…? To set a property, the following methods can be used:
Read the rest of this post…

« Previous Entries