From konsole-devel Fri Mar 14 19:14:45 2008 From: Diego Iastrubni Date: Fri, 14 Mar 2008 19:14:45 +0000 To: konsole-devel Subject: [Konsole-devel] Disable BiDi rendering in konsole4 Message-Id: <200803142114.45536.elcuco () kde ! org> X-MARC-Message: https://marc.info/?l=konsole-devel&m=120552214429844 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_l6s2HI+W+uHii1I" --Boundary-00=_l6s2HI+W+uHii1I Content-Type: text/plain; charset="windows-1255" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello all, One feature which is missing from konsole4 (comparing to konsole3) is the rendering of BiDi. In konsole3 BiDi was disabled by default and it can be enabled from the options dialog, or pressing alt+control+b. In QPainter4, there is no option for this, but it may be hacked using &LRO; +text (I will open a task in Trolltech and ask for such method in Qt4.5). Meanwhile, I have a patch here which enables/disables this feature (note that there was some code left in konsole, some variables already defined which deal with BiDi). I still am missing the keyboard shortcut to enable/disable this on the current view/profile, and I was hopping someone would give me a hint about this. The patch is attached, and I can commit if no one objects. - diego --Boundary-00=_l6s2HI+W+uHii1I Content-Type: text/x-diff; charset="windows-1255"; name="konsole4-bidi.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="konsole4-bidi.patch" Index: src/Profile.cpp =================================================================== --- src/Profile.cpp (revision 785310) +++ src/Profile.cpp (working copy) @@ -97,6 +97,7 @@ , { BlinkingTextEnabled , "BlinkingTextEnabled" , TERMINAL_GROUP , QVariant::Bool } , { FlowControlEnabled , "FlowControlEnabled" , TERMINAL_GROUP , QVariant::Bool } , { AllowProgramsToResizeWindow , "AllowProgramsToResizeWindow" , TERMINAL_GROUP , QVariant::Bool } + , { BidiRenderingEnabled , "BidiRenderingEnabled" , TERMINAL_GROUP , QVariant::Bool } , { BlinkingCursorEnabled , "BlinkingCursorEnabled" , TERMINAL_GROUP , QVariant::Bool } // Cursor Index: src/EditProfileDialog.cpp =================================================================== --- src/EditProfileDialog.cpp (revision 785310) +++ src/EditProfileDialog.cpp (working copy) @@ -922,6 +922,8 @@ SLOT(toggleResizeWindow(bool)) }, { _ui->enableBlinkingCursorButton , Profile::BlinkingCursorEnabled , SLOT(toggleBlinkingCursor(bool)) }, + { _ui->enableBidiRenderingButton , Profile::BidiRenderingEnabled , + SLOT(togglebidiRendering(bool)) }, { 0 , 0 , 0 } }; setupCombo( options , profile ); @@ -988,6 +990,10 @@ { _tempProfile->setProperty(Profile::CursorShape,index); } +void EditProfileDialog::togglebidiRendering(bool enable) +{ + _tempProfile->setProperty(Profile::BidiRenderingEnabled,enable); +} void EditProfileDialog::toggleBlinkingCursor(bool enable) { _tempProfile->setProperty(Profile::BlinkingCursorEnabled,enable); Index: src/ViewManager.cpp =================================================================== --- src/ViewManager.cpp (revision 785310) +++ src/ViewManager.cpp (working copy) @@ -715,6 +715,9 @@ bool blinkingCursor = info->property(Profile::BlinkingCursorEnabled); view->setBlinkingCursor(blinkingCursor); + bool bidiEnabled = info->property(Profile::BidiRenderingEnabled); + view->setBidiEnabled(bidiEnabled); + // cursor shape int cursorShape = info->property(Profile::CursorShape); Index: src/Profile.h =================================================================== --- src/Profile.h (revision 785310) +++ src/Profile.h (working copy) @@ -143,7 +143,8 @@ * terminal displays using this profile. */ ScrollBarPosition, - + /** (bool) Specifies whether the terminal will enable Bidirectional text display */ + BidiRenderingEnabled, /** (bool) Specifies whether text in terminal displays is allowed to blink. */ BlinkingTextEnabled, /** (bool) Specifies whether the flow control keys ( typically Ctrl+S , Ctrl+Q ) Index: src/TerminalDisplay.h =================================================================== --- src/TerminalDisplay.h (revision 785310) +++ src/TerminalDisplay.h (working copy) @@ -372,7 +372,14 @@ */ void setTerminalSizeStartup(bool on) { _terminalSizeStartup=on; } + /** + * Sets the status of the BiDi rendering inside the terminal display. + * Defaults to disabled. + */ void setBidiEnabled(bool set) { _bidiEnabled=set; } + /** + * Returns the status of the BiDi rendering in this widget. + */ bool isBidiEnabled() { return _bidiEnabled; } /** Index: src/EditProfileDialog.h =================================================================== --- src/EditProfileDialog.h (revision 785310) +++ src/EditProfileDialog.h (working copy) @@ -154,6 +154,7 @@ void toggleBlinkingText(bool); void toggleFlowControl(bool); void toggleResizeWindow(bool); + void togglebidiRendering(bool); void toggleBlinkingCursor(bool); void setCursorShape(int); Index: src/TerminalDisplay.cpp =================================================================== --- src/TerminalDisplay.cpp (revision 785310) +++ src/TerminalDisplay.cpp (working copy) @@ -653,16 +653,19 @@ // draw text if ( isLineCharString(text) ) - drawLineCharString(painter,rect.x(),rect.y(),text,style); + drawLineCharString(painter,rect.x(),rect.y(),text,style); else - { - // the drawText(rect,flags,string) overload is used here with null flags - // instead of drawText(rect,string) because the (rect,string) overload causes - // the application's default layout direction to be used instead of - // the widget-specific layout direction, which should always be - // Qt::LeftToRight for this widget - painter.drawText(rect,0,text); - } + { + // the drawText(rect,flags,string) overload is used here with null flags + // instead of drawText(rect,string) because the (rect,string) overload causes + // the application's default layout direction to be used instead of + // the widget-specific layout direction, which should always be + // Qt::LeftToRight for this widget + if (_bidiEnabled) + painter.drawText(rect,0,text); + else + painter.drawText(rect,0,QChar(0x202D)+text); + } } void TerminalDisplay::drawTextFragment(QPainter& painter , Index: src/EditProfileDialog.ui =================================================================== --- src/EditProfileDialog.ui (revision 785310) +++ src/EditProfileDialog.ui (working copy) @@ -5,8 +5,8 @@ 0 0 - 441 - 499 + 462 + 532 @@ -32,8 +32,8 @@ 0 0 - 437 - 472 + 450 + 492 @@ -238,8 +238,8 @@ 0 0 - 437 - 472 + 450 + 492 @@ -381,8 +381,8 @@ 0 0 - 437 - 472 + 450 + 492 @@ -599,8 +599,8 @@ 0 0 - 437 - 472 + 450 + 492 @@ -777,8 +777,8 @@ 0 0 - 437 - 472 + 450 + 492 @@ -867,8 +867,8 @@ 0 0 - 437 - 472 + 450 + 492 @@ -883,55 +883,75 @@ true - + - - - - 0 - 0 - - - - Allow terminal programs to create blinking sections of text - - - Allow blinking text - - + + + + + + 0 + 0 + + + + Allow terminal programs to create blinking sections of text + + + Allow blinking text + + + + + + + + 0 + 0 + + + + Allow the output to be suspended by pressing Ctrl+S + + + Enable flow control using Ctrl+S , Ctrl+Q + + + + + + + + 0 + 0 + + + + Allow terminal programs to resize the window + + + Allow programs to resize terminal window + + + + + + + + 0 + 0 + + + + Enable BiDirectional display on terminals (valid for Arabic, Farsi or Hebrew only) + + + Enable BiDi rendering + + + + - - - - - 0 - 0 - - - - Allow the output to be suspended by pressing Ctrl+S - - - Enable flow control using Ctrl+S , Ctrl+Q - - - - - - - - 0 - 0 - - - - Allow terminal programs to resize the window - - - Allow programs to resize terminal window - - - --Boundary-00=_l6s2HI+W+uHii1I Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ konsole-devel mailing list konsole-devel@kde.org https://mail.kde.org/mailman/listinfo/konsole-devel --Boundary-00=_l6s2HI+W+uHii1I--